public class ZKSplitTransactionCoordination extends Object implements SplitTransactionCoordination
Modifier and Type | Class and Description |
---|---|
static class |
ZKSplitTransactionCoordination.ZkSplitTransactionDetails
ZK-based implementation.
|
SplitTransactionCoordination.SplitTransactionDetails
Modifier and Type | Field and Description |
---|---|
private CoordinatedStateManager |
coordinationManager |
private static org.apache.commons.logging.Log |
LOG |
private ZooKeeperWatcher |
watcher |
Constructor and Description |
---|
ZKSplitTransactionCoordination(CoordinatedStateManager coordinationProvider,
ZooKeeperWatcher watcher) |
Modifier and Type | Method and Description |
---|---|
void |
clean(HRegionInfo hri)
clean the split transaction
|
void |
completeSplitTransaction(RegionServerServices services,
Region a,
Region b,
SplitTransactionCoordination.SplitTransactionDetails std,
Region parent)
Finish off split transaction, transition the zknode
|
SplitTransactionCoordination.SplitTransactionDetails |
getDefaultDetails() |
int |
processTransition(HRegionInfo p,
HRegionInfo hri_a,
HRegionInfo hri_b,
ServerName sn,
SplitTransactionCoordination.SplitTransactionDetails std)
Required by AssignmentManager
|
void |
startSplitTransaction(HRegion parent,
ServerName serverName,
HRegionInfo hri_a,
HRegionInfo hri_b)
Creates a new ephemeral node in the PENDING_SPLIT state for the specified region.
|
private int |
transitionSplittingNode(HRegionInfo parent,
HRegionInfo a,
HRegionInfo b,
ServerName serverName,
SplitTransactionCoordination.SplitTransactionDetails std,
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 |
waitForSplitTransaction(RegionServerServices services,
Region parent,
HRegionInfo hri_a,
HRegionInfo hri_b,
SplitTransactionCoordination.SplitTransactionDetails sptd)
Wait for the splitting node to be transitioned from pending_split to splitting by master.
|
private CoordinatedStateManager coordinationManager
private final ZooKeeperWatcher watcher
private static final org.apache.commons.logging.Log LOG
public ZKSplitTransactionCoordination(CoordinatedStateManager coordinationProvider, ZooKeeperWatcher watcher)
public void startSplitTransaction(HRegion parent, ServerName serverName, HRegionInfo hri_a, HRegionInfo hri_b) throws IOException
Does not transition nodes from other states. If a node already exists for this region, an Exception will be thrown.
startSplitTransaction
in interface SplitTransactionCoordination
parent
- region to be created as offlineserverName
- server event originates fromhri_a
- daughter regionhri_b
- daughter regionIOException
private int transitionSplittingNode(HRegionInfo parent, HRegionInfo a, HRegionInfo b, ServerName serverName, SplitTransactionCoordination.SplitTransactionDetails std, 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 returned.
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 splitting a region.
parent
- region to be transitioned to openeda
- Daughter a of splitb
- Daughter b of splitserverName
- server event originates fromstd
- split transaction detailsbeginState
- the expected current state the znode should beendState
- the state to be transition toIOException
public void waitForSplitTransaction(RegionServerServices services, Region parent, HRegionInfo hri_a, HRegionInfo hri_b, SplitTransactionCoordination.SplitTransactionDetails sptd) throws IOException
waitForSplitTransaction
in interface SplitTransactionCoordination
services
- Used to online/offline regions.parent
- regionhri_a
- daughter regionhri_b
- daughter regionsptd
- split transaction detailsIOException
public void completeSplitTransaction(RegionServerServices services, Region a, Region b, SplitTransactionCoordination.SplitTransactionDetails std, Region parent) throws IOException
completeSplitTransaction
in interface SplitTransactionCoordination
services
- Used to online/offline regions.a
- daughter regionb
- daughter regionstd
- split transaction detailsparent
- IOException
- If thrown, transaction failed. Call
SplitTransaction.rollback(
Server, RegionServerServices)
public void clean(HRegionInfo hri)
SplitTransactionCoordination
clean
in interface SplitTransactionCoordination
hri
- node to deletepublic SplitTransactionCoordination.SplitTransactionDetails getDefaultDetails()
getDefaultDetails
in interface SplitTransactionCoordination
public int processTransition(HRegionInfo p, HRegionInfo hri_a, HRegionInfo hri_b, ServerName sn, SplitTransactionCoordination.SplitTransactionDetails std) throws IOException
SplitTransactionCoordination
processTransition
in interface SplitTransactionCoordination
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.