aratno commented on code in PR #4118: URL: https://github.com/apache/cassandra/pull/4118#discussion_r2067020228
########## src/java/org/apache/cassandra/db/MutationIdRanges.java: ########## @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.db; + +import org.agrona.collections.Long2ObjectHashMap; +import org.apache.cassandra.io.IVersionedSerializer; +import org.apache.cassandra.io.sstable.metadata.StatsMetadata; +import org.apache.cassandra.io.util.DataInputPlus; +import org.apache.cassandra.io.util.DataOutputPlus; +import org.apache.cassandra.net.MessagingService; +import org.apache.cassandra.replication.MutationId; +import org.apache.cassandra.replication.ShortMutationId; + +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +import com.google.common.annotations.VisibleForTesting; + +import static org.apache.cassandra.db.memtable.AbstractMemtable.MutationIdCollector; + +/** + * Max mutation ID present in this SSTable for each coordinator log, to determine whether an SSTable is reconciled or + * not. Once max mutation IDs are reconciled, next compaction can safely mark this SSTabled as repaired. Note that peers + * may have reconciled all mutations included in an SSTable, but {@link StatsMetadata#repairedAt} is dependent on + * compaction timing, so "nodetool repair --validate" may report temporary disagreements on the repaired set. + * <p> + * This is immutable, so update-heavy paths are expected to use {@link MutationIdCollector}. + */ +public class MutationIdRanges +{ + public static final MutationIdRanges NONE = new MutationIdRanges(); + + // Keyed by CoordinatorLogId, this should only contain a handful of elements, because there's only one coordinator + // log per range. Iterating across keys should not be expensive, but this would benefit from a more compact Review Comment: "Handful" is ambiguous here, clarified the comment a bit. A replica could receive writes from any other replica they overlap ranges with, so up to (2*RF - 1), which I'm considering to be a fairly low number. This could balloon if lots of ownership changes happen and cleanup doesn't run (see https://github.com/apache/cassandra/pull/4118#discussion_r2066986183), but we already recommend users run cleanup between moves. -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org