Search in sources :

Example 1 with RepairedDataTracker

use of org.apache.cassandra.service.reads.repair.RepairedDataTracker in project cassandra by apache.

the class DataResolver method resolve.

public PartitionIterator resolve() {
    // We could get more responses while this method runs, which is ok (we're happy to ignore any response not here
    // at the beginning of this method), so grab the response count once and use that through the method.
    Collection<Message<ReadResponse>> messages = responses.snapshot();
    assert !any(messages, msg -> msg.payload.isDigestResponse());
    E replicas = replicaPlan().candidates().select(transform(messages, Message::from), false);
    // If requested, inspect each response for a digest of the replica's repaired data set
    RepairedDataTracker repairedDataTracker = trackRepairedStatus ? new RepairedDataTracker(getRepairedDataVerifier(command)) : null;
    if (repairedDataTracker != null) {
        messages.forEach(msg -> {
            if (msg.payload.mayIncludeRepairedDigest() && replicas.byEndpoint().get(msg.from()).isFull()) {
                repairedDataTracker.recordDigest(msg.from(), msg.payload.repairedDataDigest(), msg.payload.isRepairedDigestConclusive());
            }
        });
    }
    if (!needsReplicaFilteringProtection()) {
        ResolveContext context = new ResolveContext(replicas);
        return resolveWithReadRepair(context, i -> shortReadProtectedResponse(i, context), UnaryOperator.identity(), repairedDataTracker);
    }
    return resolveWithReplicaFilteringProtection(replicas, repairedDataTracker);
}
Also used : Arrays(java.util.Arrays) Iterables(com.google.common.collect.Iterables) EmptyPartitionsDiscarder(org.apache.cassandra.db.transform.EmptyPartitionsDiscarder) UnaryOperator(java.util.function.UnaryOperator) ReadCommand(org.apache.cassandra.db.ReadCommand) Message(org.apache.cassandra.net.Message) ReadResponse(org.apache.cassandra.db.ReadResponse) RangeTombstoneMarker(org.apache.cassandra.db.rows.RangeTombstoneMarker) ArrayList(java.util.ArrayList) UnfilteredPartitionIterator(org.apache.cassandra.db.partitions.UnfilteredPartitionIterator) DecoratedKey(org.apache.cassandra.db.DecoratedKey) Row(org.apache.cassandra.db.rows.Row) ReadRepair(org.apache.cassandra.service.reads.repair.ReadRepair) Endpoints(org.apache.cassandra.locator.Endpoints) UnfilteredRowIterator(org.apache.cassandra.db.rows.UnfilteredRowIterator) RepairedDataTracker(org.apache.cassandra.service.reads.repair.RepairedDataTracker) PartitionIterators(org.apache.cassandra.db.partitions.PartitionIterators) FilteredPartitions(org.apache.cassandra.db.transform.FilteredPartitions) Index(org.apache.cassandra.index.Index) ReplicaPlan(org.apache.cassandra.locator.ReplicaPlan) DatabaseDescriptor(org.apache.cassandra.config.DatabaseDescriptor) Filter(org.apache.cassandra.db.transform.Filter) IndexMetadata(org.apache.cassandra.schema.IndexMetadata) Collection(java.util.Collection) UnfilteredRowIterators(org.apache.cassandra.db.rows.UnfilteredRowIterators) List(java.util.List) DeletionTime(org.apache.cassandra.db.DeletionTime) ColumnFamilyStore(org.apache.cassandra.db.ColumnFamilyStore) Transformation(org.apache.cassandra.db.transform.Transformation) UnfilteredPartitionIterators(org.apache.cassandra.db.partitions.UnfilteredPartitionIterators) TableMetadata(org.apache.cassandra.schema.TableMetadata) PartitionIterator(org.apache.cassandra.db.partitions.PartitionIterator) DataLimits(org.apache.cassandra.db.filter.DataLimits) RepairedDataVerifier(org.apache.cassandra.service.reads.repair.RepairedDataVerifier) Joiner(com.google.common.base.Joiner) RepairedDataTracker(org.apache.cassandra.service.reads.repair.RepairedDataTracker) Message(org.apache.cassandra.net.Message)

Aggregations

Joiner (com.google.common.base.Joiner)1 Iterables (com.google.common.collect.Iterables)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 UnaryOperator (java.util.function.UnaryOperator)1 DatabaseDescriptor (org.apache.cassandra.config.DatabaseDescriptor)1 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)1 DecoratedKey (org.apache.cassandra.db.DecoratedKey)1 DeletionTime (org.apache.cassandra.db.DeletionTime)1 ReadCommand (org.apache.cassandra.db.ReadCommand)1 ReadResponse (org.apache.cassandra.db.ReadResponse)1 DataLimits (org.apache.cassandra.db.filter.DataLimits)1 PartitionIterator (org.apache.cassandra.db.partitions.PartitionIterator)1 PartitionIterators (org.apache.cassandra.db.partitions.PartitionIterators)1 UnfilteredPartitionIterator (org.apache.cassandra.db.partitions.UnfilteredPartitionIterator)1 UnfilteredPartitionIterators (org.apache.cassandra.db.partitions.UnfilteredPartitionIterators)1 RangeTombstoneMarker (org.apache.cassandra.db.rows.RangeTombstoneMarker)1 Row (org.apache.cassandra.db.rows.Row)1