Class LocalSessions
java.lang.Object
org.apache.cassandra.repair.consistent.LocalSessions
Manages all consistent repair sessions a node is participating in.
Since sessions need to be loaded, and since we need to handle cases where sessions might not exist, most of the logic
around local sessions is implemented in this class, with the LocalSession class being treated more like a simple struct,
in contrast with
CoordinatorSession-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHow often LocalSessions.cleanup is run -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalSessionbuildSession(LocalSession.Builder builder) voidcancelSession(TimeUUID sessionID, boolean force) hook for operators to cancel sessions, cancelling from a non-coordinator is an error, unless force is set to true.voidcleanup()Auto fails and auto deletes timed out and old sessions Compaction will clean up the sstables still owned by a deleted sessioncleanup(TableId tid, Collection<Range<Token>> ranges, boolean force) voiddeleteSession(TimeUUID sessionID) voidfailSession(LocalSession session, boolean sendMessage) voidfailSession(TimeUUID sessionID) voidfailSession(TimeUUID sessionID, boolean sendMessage) protected InetAddressAndPortlonggetFinalSessionRepairedAt(TimeUUID sessionID) Returns the repairedAt time for a sessions which is unknown, failed, or finalized calling this for a session which is in progress throws an exceptiongetLocalRanges(String keyspace) protected ActiveRepairService.ParentRepairSessiongetParentRepairSession(TimeUUID sessionID) getPendingStats(TableId tid, Collection<Range<Token>> ranges) getRepairedStats(TableId tid, Collection<Range<Token>> ranges) getSession(TimeUUID sessionID) protected TableMetadatagetTableMetadata(TableId tableId) voidvoidhandleFinalizeCommitMessage(Message<? extends RepairMessage> message) Finalizes the repair session, completing it as successful.voidhandleFinalizeProposeMessage(Message<? extends RepairMessage> message) voidhandlePrepareMessage(Message<? extends RepairMessage> message) The PrepareConsistentRequest promotes the parent repair session to a consistent incremental session, and isolates the data to be repaired from the rest of the table's data No response is sent to the repair coordinator until the data preparation / isolation has completed successfully.voidhandleStatusRequest(InetAddressAndPort from, StatusRequest request) voidhandleStatusResponse(InetAddressAndPort from, StatusResponse response) protected booleanisAlive(InetAddressAndPort address) protected booleanbooleanisSessionFinalized(TimeUUID sessionID) determines if a local session exists, and if it's in the finalized statebooleanisSessionInProgress(TimeUUID sessionID) determines if a local session exists, and if it's not finalized or failedbooleanvoidmaybeSetRepairing(TimeUUID sessionID) static voidregisterListener(LocalSessions.Listener listener) protected voidsendMessage(InetAddressAndPort destination, Message<? extends RepairMessage> message) voidsendStatusRequest(LocalSession session) voidsessionCompleted(LocalSession session) booleansessionExists(TimeUUID sessionID) determines if a local session existsprotected booleansessionHasData(LocalSession session) sessionInfo(boolean all, Set<Range<Token>> ranges) voidstart()Loads sessions out of the repairs table and sets state to startedvoidstop()static voidunregisterListener(LocalSessions.Listener listener) static void
-
Field Details
-
CLEANUP_INTERVAL
public static final int CLEANUP_INTERVALHow often LocalSessions.cleanup is run
-
-
Constructor Details
-
Method Details
-
getBroadcastAddressAndPort
-
isAlive
-
isNodeInitialized
protected boolean isNodeInitialized() -
sessionInfo
-
getTableMetadata
-
getLocalRanges
-
getRepairedStats
-
getPendingStats
-
cleanup
-
cancelSession
hook for operators to cancel sessions, cancelling from a non-coordinator is an error, unless force is set to true. Messages are sent out to other participants, but we don't wait for a response -
start
public void start()Loads sessions out of the repairs table and sets state to started -
stop
public void stop() -
isStarted
public boolean isStarted() -
cleanup
public void cleanup()Auto fails and auto deletes timed out and old sessions Compaction will clean up the sstables still owned by a deleted session -
buildSession
-
getSession
-
getParentRepairSession
protected ActiveRepairService.ParentRepairSession getParentRepairSession(TimeUUID sessionID) throws NoSuchRepairSessionException - Throws:
NoSuchRepairSessionException
-
sendMessage
protected void sendMessage(InetAddressAndPort destination, Message<? extends RepairMessage> message) -
failSession
-
failSession
-
failSession
-
deleteSession
-
handlePrepareMessage
The PrepareConsistentRequest promotes the parent repair session to a consistent incremental session, and isolates the data to be repaired from the rest of the table's data No response is sent to the repair coordinator until the data preparation / isolation has completed successfully. If the data preparation fails, a failure message is sent to the coordinator, cancelling the session. -
maybeSetRepairing
-
handleFinalizeProposeMessage
-
sessionCompleted
-
handleFinalizeCommitMessage
Finalizes the repair session, completing it as successful. This only changes the state of the session, it doesn't promote the siloed sstables to repaired. That will happen as part of the compaction process, and avoids having to worry about in progress compactions interfering with the promotion. -
handleFailSessionMessage
-
sendStatusRequest
-
handleStatusRequest
-
handleStatusResponse
-
isSessionInProgress
determines if a local session exists, and if it's not finalized or failed -
isSessionFinalized
determines if a local session exists, and if it's in the finalized state -
sessionExists
determines if a local session exists -
sessionHasData
-
getFinalSessionRepairedAt
Returns the repairedAt time for a sessions which is unknown, failed, or finalized calling this for a session which is in progress throws an exception -
registerListener
-
unregisterListener
-
unsafeClearListeners
public static void unsafeClearListeners()
-