org.apache.cassandra.service

## Class AntiEntropyService

- java.lang.Object
- - org.apache.cassandra.service.AntiEntropyService

-     public class AntiEntropyService
      extends java.lang.Object

  AntiEntropyService encapsulates "validating" (hashing) individual column families, exchanging MerkleTrees with remote nodes via a TreeRequest/Response conversation, and then triggering repairs for disagreeing ranges. Every Tree conversation has an 'initiator', where valid trees are sent after generation and where the local and remote tree will rendezvous in rendezvous(cf, endpoint, tree). Once the trees rendezvous, a Differencer is executed and the service can trigger repairs for disagreeing ranges. Tree comparison and repair triggering occur in the single threaded Stage.ANTIENTROPY. The steps taken to enact a repair are as follows: 1. A major compaction is triggered via nodeprobe: * Nodeprobe sends TreeRequest messages to all neighbors of the target node: when a node receives a TreeRequest, it will perform a readonly compaction to immediately validate the column family. 2. The compaction process validates the column family by: * Calling Validator.prepare(), which samples the column family to determine key distribution, * Calling Validator.add() in order for every row in the column family, * Calling Validator.complete() to indicate that all rows have been added. * Calling complete() indicates that a valid MerkleTree has been created for the column family. * The valid tree is returned to the requesting node via a TreeResponse. 3. When a node receives a TreeResponse, it passes the tree to rendezvous(), which checks for trees to rendezvous with / compare to: * If the tree is local, it is cached, and compared to any trees that were received from neighbors. * If the tree is remote, it is immediately compared to a local tree if one is cached. Otherwise, the remote tree is stored until a local tree can be generated. * A Differencer object is enqueued for each comparison. 4. Differencers are executed in Stage.ANTIENTROPY, to compare the two trees, and perform repair via the streaming api.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AntiEntropyService.CFPair` A tuple of table and cf.
    `static class` | `AntiEntropyService.RepairFuture`
    `static class` | `AntiEntropyService.RequestCoordinator<R>`
    `static class` | `AntiEntropyService.Status`
    `static class` | `AntiEntropyService.TreeRequest` A tuple of table, cf, address and range that represents a location we have an outstanding TreeRequest for.
    `static class` | `AntiEntropyService.TreeRequestVerbHandler` Handler for requests from remote nodes to generate a valid tree.
    `static class` | `AntiEntropyService.TreeResponseVerbHandler` Handler for responses from remote nodes which contain a valid tree.
    `static class` | `AntiEntropyService.Validator` A Strategy to handle building and validating a merkle tree for a column family.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static AntiEntropyService` | `instance`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AntiEntropyService()` Protected constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AntiEntropyService.RepairFuture` | `submitRepairSession(Range<Token> range, java.lang.String tablename, boolean isSequential, boolean isLocal, java.lang.String... cfnames)` Requests repairs for the given table and column families, and blocks until all repairs have been completed.
    `void` | `terminateSessions()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### instance

          public static final AntiEntropyService instance

  - ### Constructor Detail

    - #### AntiEntropyService

          protected AntiEntropyService()

      Protected constructor. Use AntiEntropyService.instance.

  - ### Method Detail

    - #### submitRepairSession

          public AntiEntropyService.RepairFuture submitRepairSession(Range<Token> range,
                                                            java.lang.String tablename,
                                                            boolean isSequential,
                                                            boolean isLocal,
                                                            java.lang.String... cfnames)

      Requests repairs for the given table and column families, and blocks until all repairs have been completed.
      Returns:
        Future for asynchronous call or null if there is no need to repair

    - #### terminateSessions

          public void terminateSessions()

Copyright © 2014 The Apache Software Foundation