public interface QuorumActor<S extends Remote,C extends QuorumClient<S>>
QuorumMember
service and its
cognizant AbstractQuorum
. The QuorumActor
is responsible for
making coherent changes in the distributed quorum state. However, when a
service terminates abnormally, is partitioned from the distributed quorum,
etc., then the distributed quorum state MAY temporary be inconsistent. For
example, when a service loses its zookeeper connection, zookeeper will remove
all ephemeral znodes for that service, but the order in which those
tokens are removed is not specified.
The QuorumActor
will reject operations whose preconditions are not
met (on member add, pipeline add, vote cast, service join, set token, etc.)
and for take additional operations as necessary to ensure that postconditions
are satisfied (on remove). This asymmetry in the API is intended to make it
easier for a service to "remove" itself from the various collections
maintained in the distributed quorum state.
The preconditions for add are:
memberAdd()
pipelineAdd()
castVote(long)
serviceJoin()
setToken(long)
The post-conditions for remove are:
memberRemove()
pipelineRemove()
withdrawVote()
serviceLeave()
clearToken()
The methods on this interface must be atomic with respect to the observed
state change reported by the paired QuorumWatcher
and the update of
the local Quorum
object's internal state. Without this postcondition,
a QuorumActor
could issue two requests, such as
and have the
second request rejected based on preconditions if the memberAdd()
; pipelineAdd()
;QuorumWatcher
had not yet seen the state change for the first request.
QuorumWatcher
Modifier and Type | Method and Description |
---|---|
void |
castVote(long lastCommitTime)
Cast a vote on the behalf of the associated service.
|
void |
clearToken()
Clear the quorum token.
|
void |
forceRemoveService(UUID serviceId)
Remove the service from the quorum.
|
QuorumMember<S> |
getQuorumMember()
The service on whose behalf this class is acting.
|
Quorum<S,C> |
getQuourm()
The
Quorum . |
UUID |
getServiceId()
The
UUID of the service on whose behalf this class is acting. |
void |
memberAdd()
Add the service to the set of quorum members.
|
void |
memberRemove()
Remove the service from the set of quorum members.
|
void |
pipelineAdd()
Add the service to the write pipeline.
|
void |
pipelineRemove()
Remove the service from the write pipeline.
|
void |
serviceJoin()
Add the associated service to the set of joined services for the quorum.
|
void |
serviceLeave()
Remove the associated service from the set of joined services for the
quorum.
|
void |
setToken(long newToken)
Atomically set the lastValidToken and the current token on the quorum
equal to the given token.
|
void |
withdrawVote()
Withdraw the vote cast by the service (a service has only one vote).
|
QuorumMember<S> getQuorumMember()
void memberAdd()
void memberRemove()
void pipelineAdd()
void pipelineRemove()
void castVote(long lastCommitTime)
When a service needs to re-synchronize with a quorum, it initially votes its current lastCommitTime. Once the service is receiving writes from the write pipeline and has synchronized any historical delta, it will update its vote and join the quorum at the next commit point (or immediately if there are no outstanding writes against the quorum).
lastCommitTime
- The lastCommitTime timestamp for which the service casts its
vote.IllegalArgumentException
- if the lastCommitTime is negative.void withdrawVote()
void serviceJoin()
void serviceLeave()
void setToken(long newToken)
newToken := lastValidToken + 1
.void clearToken()
void forceRemoveService(UUID serviceId)
serviceId
- The UUID of the service to be removed.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.