Class TransitRegionStateProcedure

All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>, TableProcedureInterface

@Private public class TransitRegionStateProcedure extends AbstractStateMachineRegionProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RegionStateTransitionState>
The procedure to deal with the state transition of a region. A region with a TRSP in place is called RIT, i.e, RegionInTransition.

It can be used to assign/unassign/reopen/move a region, and for unassign(MasterProcedureEnv, RegionInfo) and reopen(MasterProcedureEnv, RegionInfo), you do not need to specify a target server, and for assign(MasterProcedureEnv, RegionInfo, ServerName) and move(MasterProcedureEnv, RegionInfo, ServerName), if you want to you can provide a target server. And for move(MasterProcedureEnv, RegionInfo, ServerName), if you do not specify a targetServer, we will select one randomly.

The typical state transition for assigning a region is:

Notice that, if there are failures we may go back to the GET_ASSIGN_CANDIDATE state to try again.

The typical state transition for unassigning a region is:

Here things go a bit different, if there are failures, especially that if there is a server crash, we will go to the GET_ASSIGN_CANDIDATE state to bring the region online first, and then go through the normal way to unassign it.

The typical state transition for reopening/moving a region is:

The retry logic is the same with the above assign/unassign.

Notice that, although we allow specify a target server, it just acts as a candidate, we do not guarantee that the region will finally be on the target server. If this is important for you, you should check whether the region is on the target server after the procedure is finished.

Altenatively, for trying retaining assignments, the hbase.master.scp.retain.assignment.force option can be used together with hbase.master.scp.retain.assignment.

When you want to schedule a TRSP, please check whether there is still one for this region, and the check should be under the RegionStateNode lock. We will remove the TRSP from a RegionStateNode when we are done, see the code in reportTransition method below. There could be at most one TRSP for a give region.