Repository: hbase
Updated Branches:
  refs/heads/master ad580acc8 -> 811afad10


HBASE-19915 Create merged/ daughter region/s with initial state CLOSED from 
MetaTableAccessor#splitRegion()/ mergeRegions()

If the initial state is not set to CLOSED while creating merged/ children 
region/s, merged/
children region/s get stored in meta with state OFFLINE(0). If the master gets 
restarted after
Merge/ Split procedure stores merged/ children region/s, master startup 
sequence tries to assign
offline region/s. This is followed by re-assignment of merged/ children region 
from resumed Merge/
Split procedure.

This bug is related to HBASE-19530.

Signed-off-by: Michael Stack <st...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/811afad1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/811afad1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/811afad1

Branch: refs/heads/master
Commit: 811afad103dacfe50788f08b41d804e216af5afc
Parents: ad580ac
Author: Umesh Agashe <uaga...@cloudera.com>
Authored: Thu Feb 1 15:43:32 2018 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Fri Feb 2 18:25:20 2018 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/MetaTableAccessor.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/811afad1/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
index 938874a..f80bbc0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
@@ -1679,6 +1679,13 @@ public class MetaTableAccessor {
               .setValue(RegionInfo.toByteArray(regionB))
               .build());
 
+      // Set initial state to CLOSED
+      // NOTE: If initial state is not set to CLOSED then merged region gets 
added with the
+      // default OFFLINE state. If Master gets restarted after this step, 
start up sequence of
+      // master tries to assign this offline region. This is followed by 
re-assignments of the
+      // merged region from resumed {@link MergeTableRegionsProcedure}
+      addRegionStateToPut(putOfMerged, RegionState.State.CLOSED);
+
       // Deletes for merging regions
       Delete deleteA = makeDeleteFromRegionInfo(regionA, time);
       Delete deleteB = makeDeleteFromRegionInfo(regionB, time);
@@ -1743,6 +1750,14 @@ public class MetaTableAccessor {
       Put putA = makePutFromRegionInfo(splitA);
       Put putB = makePutFromRegionInfo(splitB);
 
+      // Set initial state to CLOSED
+      // NOTE: If initial state is not set to CLOSED then daughter regions get 
added with the
+      // default OFFLINE state. If Master gets restarted after this step, 
start up sequence of
+      // master tries to assign these offline regions. This is followed by 
re-assignments of the
+      // daughter regions from resumed {@link SplitTableRegionProcedure}
+      addRegionStateToPut(putA, RegionState.State.CLOSED);
+      addRegionStateToPut(putA, RegionState.State.CLOSED);
+
       addSequenceNum(putA, 1, -1, splitA.getReplicaId()); //new regions, 
openSeqNum = 1 is fine.
       addSequenceNum(putB, 1, -1, splitB.getReplicaId());
 

Reply via email to