public class ZkRegionMergeCoordination extends Object implements RegionMergeCoordination
Modifier and Type | Class and Description |
---|---|
static class |
ZkRegionMergeCoordination.ZkRegionMergeDetails
ZK-based implementation.
|
RegionMergeCoordination.RegionMergeDetails
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG |
private CoordinatedStateManager |
manager |
private ZooKeeperWatcher |
watcher |
Constructor and Description |
---|
ZkRegionMergeCoordination(CoordinatedStateManager manager,
ZooKeeperWatcher watcher) |
Modifier and Type | Method and Description |
---|---|
void |
clean(HRegionInfo hri)
This method is used during rollback
|
void |
completeRegionMergeTransaction(RegionServerServices services,
HRegionInfo mergedRegionInfo,
HRegion region_a,
HRegion region_b,
RegionMergeCoordination.RegionMergeDetails rmd,
HRegion mergedRegion)
Finish off merge transaction
|
void |
confirmRegionMergeTransaction(HRegionInfo merged,
HRegionInfo a,
HRegionInfo b,
ServerName serverName,
RegionMergeCoordination.RegionMergeDetails rmd)
Confirm that the region merge can be performed
|
RegionMergeCoordination.RegionMergeDetails |
getDefaultDetails() |
void |
processRegionMergeRequest(HRegionInfo p,
HRegionInfo hri_a,
HRegionInfo hri_b,
ServerName sn,
RegionMergeCoordination.RegionMergeDetails rmd) |
void |
startRegionMergeTransaction(HRegionInfo region,
ServerName serverName,
HRegionInfo a,
HRegionInfo b)
Creates a new ephemeral node in the PENDING_MERGE state for the merged region.
|
private void |
transitionMergingNode(HRegionInfo merged,
HRegionInfo a,
HRegionInfo b,
ServerName serverName,
RegionMergeCoordination.RegionMergeDetails rmd,
EventType beginState,
EventType endState)
Transitions an existing ephemeral node for the specified region which is
currently in the begin state to be in the end state.
|
void |
waitForRegionMergeTransaction(RegionServerServices services,
HRegionInfo mergedRegionInfo,
HRegion region_a,
HRegion region_b,
RegionMergeCoordination.RegionMergeDetails details)
Wait for the merging node to be transitioned from pending_merge
to merging by master.
|
private CoordinatedStateManager manager
private final ZooKeeperWatcher watcher
private static final org.apache.commons.logging.Log LOG
public ZkRegionMergeCoordination(CoordinatedStateManager manager, ZooKeeperWatcher watcher)
public RegionMergeCoordination.RegionMergeDetails getDefaultDetails()
getDefaultDetails
in interface RegionMergeCoordination
public void waitForRegionMergeTransaction(RegionServerServices services, HRegionInfo mergedRegionInfo, HRegion region_a, HRegion region_b, RegionMergeCoordination.RegionMergeDetails details) throws IOException
waitForRegionMergeTransaction
in interface RegionMergeCoordination
IOException
public void startRegionMergeTransaction(HRegionInfo region, ServerName serverName, HRegionInfo a, HRegionInfo b) throws IOException
Does not transition nodes from other states. If a node already exists for
this region, a KeeperException.NodeExistsException
will be thrown.
startRegionMergeTransaction
in interface RegionMergeCoordination
region
- region to be created as offlineserverName
- server event originates fromIOException
public void clean(HRegionInfo hri)
RegionMergeCoordination
clean
in interface RegionMergeCoordination
hri
- region to be rolled backpublic void completeRegionMergeTransaction(RegionServerServices services, HRegionInfo mergedRegionInfo, HRegion region_a, HRegion region_b, RegionMergeCoordination.RegionMergeDetails rmd, HRegion mergedRegion) throws IOException
RegionMergeCoordination
completeRegionMergeTransaction
in interface RegionMergeCoordination
services
- Used to online/offline regions.mergedRegionInfo
- regionregion_a
- merging region Aregion_b
- merging region Brmd
- region merge detailsIOException
- If thrown, transaction failed. Call
RegionMergeTransaction.rollback(
Server, RegionServerServices)
public void confirmRegionMergeTransaction(HRegionInfo merged, HRegionInfo a, HRegionInfo b, ServerName serverName, RegionMergeCoordination.RegionMergeDetails rmd) throws IOException
RegionMergeCoordination
confirmRegionMergeTransaction
in interface RegionMergeCoordination
merged
- regiona
- merging region Ab
- merging region BserverName
- server event originates fromrmd
- region merge detailsIOException
- If thrown, transaction failed.public void processRegionMergeRequest(HRegionInfo p, HRegionInfo hri_a, HRegionInfo hri_b, ServerName sn, RegionMergeCoordination.RegionMergeDetails rmd) throws IOException
processRegionMergeRequest
in interface RegionMergeCoordination
p
- regionhri_a
- merging region Ahri_b
- merging region Bsn
- server event originates fromrmd
- region merge detailsIOException
private void transitionMergingNode(HRegionInfo merged, HRegionInfo a, HRegionInfo b, ServerName serverName, RegionMergeCoordination.RegionMergeDetails rmd, EventType beginState, EventType endState) throws IOException
Does not transition nodes from other states. If for some reason the node could not be transitioned, the method returns -1. If the transition is successful, the version of the node after transition is updated in details.
This method can fail and return false for three different reasons:
Does not set any watches.
This method should only be used by a RegionServer when merging two regions.
merged
- region to be transitioned to openeda
- merging region Ab
- merging region BserverName
- server event originates fromrmd
- region merge detailsbeginState
- the expected current state the node should beendState
- the state to be transition toIOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.