Class ConsensusManager
java.lang.Object
org.apache.iotdb.confignode.manager.consensus.ConsensusManager
ConsensusManager maintains consensus class, request will redirect to consensus layer.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConsensusManager(IManager configManager, ConfigRegionStateMachine stateMachine) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigNodePeer(TConfigNodeLocation configNodeLocation) Add a new ConfigNode Peer into ConfigRegion.voidclose()Confirm the current ConfigNode's leadership.voidcreatePeerForConsensusGroup(List<TConfigNodeLocation> configNodeLocations) Create peer in new node to build consensus group.static StringbooleanbooleanisLeader()booleanbooleanvoidread(ConfigPhysicalReadPlan plan) Transmit PhysicalPlan to confignode.consensus.statemachinebooleanremoveConfigNodePeer(TConfigNodeLocation configNodeLocation) Remove a ConfigNode Peer out of ConfigRegion.voidstart()write(ConfigPhysicalPlan plan) Transmit PhysicalPlan to confignode.consensus.statemachine
-
Field Details
-
DEFAULT_CONSENSUS_GROUP_ID
There is only one ConfigNodeGroup
-
-
Constructor Details
-
ConsensusManager
-
-
Method Details
-
start
- Throws:
IOException
-
close
- Throws:
IOException
-
createPeerForConsensusGroup
public void createPeerForConsensusGroup(List<TConfigNodeLocation> configNodeLocations) throws ConsensusException Create peer in new node to build consensus group.- Parameters:
configNodeLocations- All registered ConfigNodes- Throws:
ConsensusException- When addPeer doesn't success
-
addConfigNodePeer
Add a new ConfigNode Peer into ConfigRegion.- Parameters:
configNodeLocation- The new ConfigNode- Throws:
AddPeerException- When addPeer doesn't success
-
removeConfigNodePeer
Remove a ConfigNode Peer out of ConfigRegion.- Parameters:
configNodeLocation- config node location- Returns:
- True if successfully removePeer. False if another ConfigNode is being removed to the ConfigRegion
-
write
Transmit PhysicalPlan to confignode.consensus.statemachine- Throws:
ConsensusException- When write doesn't success
-
read
Transmit PhysicalPlan to confignode.consensus.statemachine- Throws:
ConsensusException- When read doesn't success
-
isLeader
public boolean isLeader() -
isLeaderReady
public boolean isLeaderReady() -
getLeaderLocation
- Returns:
- ConfigNode-leader's location if leader exists, null otherwise.
-
isLeaderExist
public boolean isLeaderExist()- Returns:
- true if ConfigNode-leader is elected, false otherwise.
-
confirmLeader
Confirm the current ConfigNode's leadership.- Returns:
- SUCCESS_STATUS if the current ConfigNode is leader and has been ready yet, NEED_REDIRECTION otherwise
-
getConsensusGroupId
-
getConfigRegionDir
-
getConsensusImpl
-
manuallyTakeSnapshot
- Throws:
ConsensusException
-
isInitialized
public boolean isInitialized()
-