aweisberg commented on code in PR #4696:
URL: https://github.com/apache/cassandra/pull/4696#discussion_r3074843393
##########
src/java/org/apache/cassandra/repair/RepairCoordinator.java:
##########
@@ -113,20 +117,70 @@ public class RepairCoordinator implements Runnable,
ProgressEventNotifier, Repai
final SharedContext ctx;
final Scheduler validationScheduler;
+ // Mutation tracking decision, snapshotted once at creation time from TCM
+ final boolean useMutationTracking;
+ final boolean mutationTrackingMigrationInProgress;
+ final ClusterMetadata metadata;
+
private TraceState traceState;
- public RepairCoordinator(StorageService storageService, int cmd,
RepairOption options, String keyspace, Epoch minEpoch)
+ /**
+ * Creates a RepairCoordinator, snapshotting TCM state to decide whether
mutation tracking
+ * should be used. If mutation tracking is active for the keyspace (and no
migration is in progress),
+ * the incremental flag in RepairOption is flipped to false to prevent
anti-compaction.
+ */
+ public static RepairCoordinator create(StorageService storageService, int
cmd, RepairOption options, String keyspace, Epoch minEpoch)
{
- this(SharedContext.Global.instance,
- (ks, tables) -> storageService.getValidColumnFamilies(false,
false, ks, tables),
- storageService::getLocalReplicas,
- cmd, options, keyspace, minEpoch);
+ ClusterMetadata metadata = ClusterMetadata.current();
+ boolean useMT = options.isIncremental()
+ &&
MutationTrackingIncrementalRepairTask.shouldUseMutationTrackingRepair(metadata,
keyspace);
+ boolean mtMigration = useMT
+ &&
MutationTrackingIncrementalRepairTask.isMutationTrackingMigrationInProgress(metadata,
keyspace);
+
+ // If using mutation tracking without migration, flip incremental to
false
+ // to prevent anti-compaction since mutation tracking manages marking
tables repaired itself
+ if (useMT && !mtMigration)
+ {
+ logger.info("Keyspace {} uses mutation tracking; disabling
incremental repair to skip anti-compaction", keyspace);
+ options = options.withIncremental(false);
+ }
+
+ // During migration, validate that repair ranges don't partially
overlap with pending migration ranges.
+ // Ranges must be entirely inside or entirely outside the pending set
so that a compatible repair
+ // behavior (MT vs normal IR) can be selected.
+ if (mtMigration)
+ {
+ KeyspaceMigrationInfo migrationInfo =
metadata.mutationTrackingMigrationState.getKeyspaceInfo(keyspace);
+ if (migrationInfo != null)
Review Comment:
Yes I will restructure this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]