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 <stack@apache.org>
This commit is contained in:
Umesh Agashe 2018-02-01 15:43:32 -08:00 committed by Michael Stack
parent 3398637bcd
commit fdbc843516
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
1 changed files with 15 additions and 0 deletions

View File

@ -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());