use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class CatchupPollingProcess method copyStore.
private void copyStore() {
MemberId upstream;
try {
upstream = selectionStrategyPipeline.bestUpstreamDatabase();
} catch (UpstreamDatabaseSelectionException e) {
log.warn("Could not find upstream database from which to copy store", e);
return;
}
StoreId localStoreId = localDatabase.storeId();
downloadDatabase(upstream, localStoreId);
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class RaftMembershipManager method append.
@Override
public void append(long baseIndex, RaftLogEntry... entries) throws IOException {
for (RaftLogEntry entry : entries) {
if (entry.content() instanceof RaftGroup) {
RaftGroup<MemberId> raftGroup = (RaftGroup<MemberId>) entry.content();
if (state.uncommittedMemberChangeInLog()) {
log.warn("Appending with uncommitted membership change in log");
}
if (state.append(baseIndex, new HashSet<>(raftGroup.getMembers()))) {
log.info("Appending new member set %s", state);
storage.persistStoreData(state);
updateMemberSets();
} else {
log.warn("Appending member set was ignored. Current state: %s, Appended set: %s, Log index: %d%n", state, raftGroup, baseIndex);
}
}
baseIndex++;
}
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class Leader method sendHeartbeats.
static void sendHeartbeats(ReadableRaftState ctx, Outcome outcome) throws IOException {
long commitIndex = ctx.commitIndex();
long commitIndexTerm = ctx.entryLog().readEntryTerm(commitIndex);
Heartbeat heartbeat = new Heartbeat(ctx.myself(), ctx.term(), commitIndex, commitIndexTerm);
for (MemberId to : replicationTargets(ctx)) {
outcome.addOutgoingMessage(new RaftMessages.Directed(to, heartbeat));
}
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class RaftLogShippingManager method onMembershipChanged.
@Override
public synchronized void onMembershipChanged() {
if (lastLeaderContext == null || !running) {
return;
}
HashSet<MemberId> toBeRemoved = new HashSet<>(logShippers.keySet());
toBeRemoved.removeAll(membership.replicationMembers());
for (MemberId member : toBeRemoved) {
RaftLogShipper logShipper = logShippers.remove(member);
if (logShipper != null) {
logShipper.stop();
}
}
for (MemberId replicationMember : membership.replicationMembers()) {
ensureLogShipperRunning(replicationMember, lastLeaderContext);
}
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class DistributedOperation method deserialize.
public static DistributedOperation deserialize(ReadableChannel channel) throws IOException, EndOfStreamException {
long mostSigBits = channel.getLong();
long leastSigBits = channel.getLong();
MemberId owner = new MemberId.Marshal().unmarshal(channel);
GlobalSession globalSession = new GlobalSession(new UUID(mostSigBits, leastSigBits), owner);
long localSessionId = channel.getLong();
long sequenceNumber = channel.getLong();
LocalOperationId localOperationId = new LocalOperationId(localSessionId, sequenceNumber);
ReplicatedContent content = new CoreReplicatedContentMarshal().unmarshal(channel);
return new DistributedOperation(content, globalSession, localOperationId);
}
Aggregations