Class RepairSession

  • All Implemented Interfaces:
    com.google.common.util.concurrent.ListenableFuture<RepairSessionResult>, io.netty.util.concurrent.Future<RepairSessionResult>, java.util.concurrent.Future<RepairSessionResult>, IEndpointStateChangeSubscriber, IFailureDetectionEventListener, LocalSessions.Listener, Awaitable, Future<RepairSessionResult>

    public class RepairSession
    extends AsyncFuture<RepairSessionResult>
    implements IEndpointStateChangeSubscriber, IFailureDetectionEventListener, LocalSessions.Listener
    Coordinates the (active) repair of a list of non overlapping token ranges. A given RepairSession repairs a set of replicas for a given set of ranges on a list of column families. For each of the column family to repair, RepairSession creates a RepairJob that handles the repair of that CF. A given RepairJob has the 3 main phases:
    1. Paxos repair: unfinished paxos operations in the range/keyspace/table are first completed
    2. Validation phase: the job requests merkle trees from each of the replica involves (ValidationTask) and waits until all trees are received (in validationComplete()).
    3. Synchronization phase: once all trees are received, the job compares each tree with all the others. If there is difference between 2 trees, the differences between the 2 endpoints will be streamed with a SyncTask.
    The job is done once all its SyncTasks are done (i.e. have either computed no differences or the streaming they started is done (syncComplete())). A given session will execute the first phase (validation phase) of each of it's job sequentially. In other words, it will start the first job and only start the next one once that first job validation phase is complete. This is done so that the replica only create one merkle tree per range at a time, which is our way to ensure that such creation starts roughly at the same time on every node (see CASSANDRA-2816). However the synchronization phases are allowed to run concurrently (with each other and with validation phases). A given RepairJob has 2 modes: either sequential or not (RepairParallelism). If sequential, it will requests merkle tree creation from each replica in sequence (though in that case we still first send a message to each node to flush and snapshot data so each merkle tree creation is still done on similar data, even if the actual creation is not done simulatneously). If not sequential, all merkle tree are requested in parallel. Similarly, if a job is sequential, it will handle one SymmetricSyncTask at a time, but will handle all of them in parallel otherwise.
    • Field Detail

      • pullRepair

        public final boolean pullRepair
      • isIncremental

        public final boolean isIncremental
        Range to repair
      • repairPaxos

        public final boolean repairPaxos
      • paxosOnly

        public final boolean paxosOnly
      • taskExecutor

        public final org.apache.cassandra.repair.RepairSession.SafeExecutor taskExecutor
      • optimiseStreams

        public final boolean optimiseStreams
      • validationScheduler

        public final Scheduler validationScheduler
    • Constructor Detail

      • RepairSession

        public RepairSession​(SharedContext ctx,
                             Scheduler validationScheduler,
                             TimeUUID parentRepairSession,
                             CommonRange commonRange,
                             java.lang.String keyspace,
                             RepairParallelism parallelismDegree,
                             boolean isIncremental,
                             boolean pullRepair,
                             PreviewKind previewKind,
                             boolean optimiseStreams,
                             boolean repairPaxos,
                             boolean paxosOnly,
                             java.lang.String... cfnames)
        Create new repair session.
        Parameters:
        parentRepairSession - the parent sessions id
        commonRange - ranges to repair
        keyspace - name of keyspace
        parallelismDegree - specifies the degree of parallelism when calculating the merkle trees
        pullRepair - true if the repair should be one way (from remote host to this host and only applicable between two hosts--see RepairOption)
        repairPaxos - true if incomplete paxos operations should be completed as part of repair
        paxosOnly - true if we should only complete paxos operations, not run a normal repair
        cfnames - names of columnfamilies