Search in sources :

Example 1 with SyncStatSummary

use of org.apache.cassandra.repair.consistent.SyncStatSummary in project cassandra by apache.

the class PreviewRepairTask method performUnsafe.

@Override
public Future<CoordinatedRepairResult> performUnsafe(ExecutorPlus executor) {
    Future<CoordinatedRepairResult> f = runRepair(parentSession, false, executor, commonRanges, cfnames);
    return f.map(result -> {
        if (result.hasFailed())
            return result;
        PreviewKind previewKind = options.getPreviewKind();
        Preconditions.checkState(previewKind != PreviewKind.NONE, "Preview is NONE");
        SyncStatSummary summary = new SyncStatSummary(true);
        summary.consumeSessionResults(result.results);
        final String message;
        if (summary.isEmpty()) {
            message = previewKind == PreviewKind.REPAIRED ? "Repaired data is in sync" : "Previewed data was in sync";
        } else {
            message = (previewKind == PreviewKind.REPAIRED ? "Repaired data is inconsistent\n" : "Preview complete\n") + summary;
            RepairMetrics.previewFailures.inc();
            if (previewKind == PreviewKind.REPAIRED)
                // we know its present as summary used it
                maybeSnapshotReplicas(parentSession, keyspace, result.results.get());
        }
        notifier.notification(message);
        return result;
    });
}
Also used : PreviewKind(org.apache.cassandra.streaming.PreviewKind) SyncStatSummary(org.apache.cassandra.repair.consistent.SyncStatSummary)

Aggregations

SyncStatSummary (org.apache.cassandra.repair.consistent.SyncStatSummary)1 PreviewKind (org.apache.cassandra.streaming.PreviewKind)1