public interface QuorumStateChangeListener
QuorumMember
. These messages
are generated by the QuorumWatcher
for the QuorumMember
when
it notices the corresponding change in the distributed quorum state. Thus,
all methods on this interface indicate observed state changes. The
QuorumActor
is responsible for causing changes in the distributed
quorum state, but it DOES NOT generate these messages - that task falls to
the QuorumWatcher
.
Quorum members have strict preconditions on their actions, which are
documented by the QuorumActor
. In addition, QuorumWatcher
maintains various postconditions (for example, a member leave implies a
service leave). Together, these preconditions and postconditions imply an
ordering over the QuorumStateChangeListener
s.
However, because this interface reports observed state changes, it is possible that some events may occur "out of order". For example, if the quorum is maintained within zookeeper and a client looses its zookeeper connection, then zookeeper will the ephemeral znodes for that client. The order in which other clients observe those state changes in essentially arbitrary.
Implementations of this interface must not block in the event thread.
QuorumMember
,
QuorumActor
,
QuorumWatcher
,
HAJournalServer reports "follower" but is in SeekConsensus and is not
participating in commits (javadoc clarifications)Modifier and Type | Method and Description |
---|---|
void |
consensus(long lastCommitTime)
Invoked when a consensus has been achieved among
(k+1)/2
services concerning a shared lastCommitTime (really, this is not a
consensus but a simple majority). |
void |
lostConsensus()
Invoked when the consensus is lost.
|
void |
memberAdd()
Invoked when this service is added as a quorum member.
|
void |
memberRemove()
Invoked when this service is removed as a quorum member.
|
void |
pipelineAdd()
Invoked when this service is added to the write pipeline.
|
void |
pipelineChange(UUID oldDownStreamId,
UUID newDownStreamId)
Invoked for this service when the downstream service in the write
pipeline has changed.
|
void |
pipelineElectedLeader()
Invoked for this service when the service is already in the pipeline and
this service becomes the first service in the write pipeline because all
previous services in the pipeline order have been removed from the
pipeline (failover into the leader position).
|
void |
pipelineRemove()
Invoked when this service is removed from the write pipeline.
|
void |
pipelineUpstreamChange()
Invoked for this service when the upstream service in the write pipeline
has been removed.
|
void |
quorumBreak()
Invoked when a quorum breaks.
|
void |
quorumMeet(long token,
UUID leaderId)
Invoked when a quorum meets.
|
void |
serviceJoin()
Invoked when this service joins the quorum.
|
void |
serviceLeave()
Invoked when this service leaves the quorum.
|
void memberAdd()
void memberRemove()
void pipelineAdd()
void pipelineRemove()
void pipelineElectedLeader()
void pipelineChange(UUID oldDownStreamId, UUID newDownStreamId)
oldDownstreamId
- The UUID
of the service which was downstream
from this service in the write pipeline and null
iff this service was the last service in the pipeline.newDownstreamId
- The UUID
of the service which is downstream
from this service in the write pipeline and null
iff this service is the last service in the pipeline.void pipelineUpstreamChange()
void consensus(long lastCommitTime)
(k+1)/2
services concerning a shared lastCommitTime (really, this is not a
consensus but a simple majority). This message is sent to each member
service regardless of whether or not they participated in the consensus.
Once a consensus has been reached, each QuorumMember
which agrees
on that lastCommitTime MUST do a serviceJoin()
before the
quorum will meet. The first quorum member to do a service join will be
elected the leader. The remaining services to do a service join will be
elected followers.
lastCommitTime
- The last commit time around which a consensus was established.serviceJoin()
,
#electedLeader(long)
,
#electedFollower(long)
,
lostConsensus()
void lostConsensus()
consensus(long)
void serviceJoin()
void serviceLeave()
void quorumMeet(long token, UUID leaderId)
#isLeader(long)
, joined as a
follower (using #isFollower(long)
), or do not participate
in the quorum (this message is sent to all quorum members, so this
service might not be part of the met qourum).
The following pre-conditions will be satisfied before this message is
sent to the QuorumMember
:
(k+1)/2
services which have voted
for the same lastCommitTime.(k+1)/2
services joined with the
quorum. The join order
will be the same
as the Quorum.getVotes()
for the services which voted for the
lastCommitTimememberAdd()
, pipelineAdd()
,
consensus(long)
, and serviceJoin()
events.When control returns from this method, the following post-conditions should be true:
QuorumMember
is joined with the quorum but it can not
satisfy these post-conditions, then it must
leave
the Quorum
.token
- The newly assigned quorum token.leaderId
- The UUID
of the service which was elected to be the
quorum leader. This information is only valid for the scope of
the accompanying quorum token. (The leaderId may be obtained
from #getLeader(long)
at any time for a met quorum.)void quorumBreak()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.