diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 9549a13..d207b0c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -301,6 +301,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi private final int rowLockWaitDuration; private CompactedHFilesDischarger compactedFileDischarger; static final int DEFAULT_ROWLOCK_WAIT_DURATION = 30000; + + private byte[] lastMarkerRegionName = null; // The internal wait duration to acquire a lock before read/update // from the region. It is not per row. The purpose of this wait time @@ -829,8 +831,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi this.mvcc.advanceTo(maxSeqId); if (ServerRegionReplicaUtil.shouldReplayRecoveredEdits(this)) { // Recover any edits if available. - maxSeqId = Math.max(maxSeqId, - replayRecoveredEditsIfAny(this.fs.getRegionDir(), maxSeqIdInStores, reporter, status)); + try { + maxSeqId = Math.max(maxSeqId, + replayRecoveredEditsIfAny(this.fs.getRegionDir(), maxSeqIdInStores, reporter, status)); + } finally { + lastMarkerRegionName = null; + } // Make sure mvcc is up to max. this.mvcc.advanceTo(maxSeqId); } @@ -5007,7 +5013,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi */ private void checkTargetRegion(byte[] encodedRegionName, String exceptionMsg, Object payload) throws WrongRegionException { - if (Bytes.equals(this.getRegionInfo().getEncodedNameAsBytes(), encodedRegionName)) { + if (Bytes.equals(lastMarkerRegionName, encodedRegionName)) { return; } @@ -5016,6 +5022,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi this.fs.getRegionInfoForFS().getEncodedNameAsBytes())) { return; } + if (lastMarkerRegionName == null) { + lastMarkerRegionName = encodedRegionName; + return; + } throw new WrongRegionException(exceptionMsg + payload + " targetted for region " + Bytes.toStringBinary(encodedRegionName) @@ -7550,8 +7560,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi public static final long FIXED_OVERHEAD = ClassSize.align( ClassSize.OBJECT + - ClassSize.ARRAY + - 44 * ClassSize.REFERENCE + 3 * Bytes.SIZEOF_INT + + 2 * ClassSize.ARRAY + + 45 * ClassSize.REFERENCE + 3 * Bytes.SIZEOF_INT + (14 * Bytes.SIZEOF_LONG) + 5 * Bytes.SIZEOF_BOOLEAN);