aratno commented on code in PR #4118: URL: https://github.com/apache/cassandra/pull/4118#discussion_r2082800891
########## src/java/org/apache/cassandra/db/CoordinatorLogBoundaries.java: ########## @@ -0,0 +1,155 @@ +/* + * 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 java.io.IOException; +import java.util.Iterator; +import java.util.NoSuchElementException; + +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.CoordinatorLogId; +import org.apache.cassandra.replication.MutationId; +import org.apache.cassandra.utils.vint.VIntCoding; + +/** + * 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> + * Iterable over {@link CoordinatorLogId}. + */ +public abstract class CoordinatorLogBoundaries implements Iterable<Long> Review Comment: Going to respond to a couple class structure comments here: - https://github.com/apache/cassandra/pull/4118#discussion_r2078025024 - https://github.com/apache/cassandra/pull/4118#discussion_r2078023815 I wanted to avoid `max` and `size` being in the public API, and I'd like to have some profiling data before optimizing pointer-chasing the reference to the internal map. That map is final and should have locality with any references to the parent, and pointer-chasing the slots in the map will not have locality and likely be more expensive. But this is speculative without profiling data, happy to revise down the line when the interfaces are more stable and profiling indicates the opportunity. > Since the boundaries returned is the mutable instance anyways it doesn't help with blocking access to mutability which is one of the reasons to use a builder. I'm roughly following the same pattern as DeletionInfo / MutableDeletionInfo here. Yes - a user could cast to the mutable implementation, but they shouldn't. I've added a comment to indicate this. I've also updated the Builder to use a NonThreadSafe helper, that should be faster for the single-threaded building case. I also thought about avoiding autoboxing on the iteration path, using something like PrimitiveIterable.OfLong. -- 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