Support executing region merge transaction on Regionserver, similar with split transaction
Process of merging two regions:
a.client sends RPC (dispatch merging regions) to master
b.master moves the regions together (on the same regionserver where the more heavily loaded region resided)
c.master sends RPC (merge regions) to this regionserver
d.Regionserver executes the region merge transaction in the thread pool
e.the above b,c,d run asynchronously
Process of region merge transaction:
a.Construct a new region merge transaction.
b.prepare for the merge transaction, the transaction will be canceled if it is unavailable,
e.g. two regions don't belong to same table; two regions are not adjacent in a non-compulsory merge; region is closed or has reference
c.execute the transaction as the following:
- Set region as in transition, set it into MERGING state.
- We created the temporary merge data directory.
- Closed the merging region A.
- The merging region A has been taken out of the server's online regions list.
- Closed the merging region B.
- The merging region B has been taken out of the server's online regions list.
- Started in on creation of the merged region.
- Point of no return. If we got here, then transaction is not recoverable
- other than by crashing out the regionserver.
d.roll back if step c throws exception
See more details from the patch