belliottsmith commented on code in PR #113: URL: https://github.com/apache/cassandra-accord/pull/113#discussion_r1746041202
########## accord-core/src/main/java/accord/impl/progresslog/PackedKeyTracker.java: ########## @@ -0,0 +1,162 @@ +/* + * 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 accord.impl.progresslog; + +import accord.local.Node; +import accord.primitives.Ranges; +import accord.primitives.Routables; +import accord.primitives.Route; +import accord.primitives.TxnId; +import accord.primitives.Unseekables; +import accord.utils.Invariants; + +/** + * Using a predefined number of bits, store state allowing us to iterate through participating keys in groups + * small enough we can maintain a bitset of the keys that have met our desired criteria. + * + * This permits us to register remote callbacks with minimal state on the sender and recipient and track a transaction's + * progress towards whatever local or distributed state we need to achieve. + * + * We split the bits dynamically between a bitSet and a roundIndex. + * The bitSet has a number of bits equal to the roundSize, and the roundIndex has enough bits + * to encode the total number of rounds we need of the given size. + * <p> + * In the typical case we have one round with enough bits for all keys. + * At the other extreme we have many rounds each fetching a single key because we have too many keys + * to represent in the number of bits available. + */ +public class PackedKeyTracker Review Comment: Right. If we can encode in the bitmap we do so, otherwise we encode a counter large enough to count the number of bitmaps we have to use, and we walk through the groups of keys in bitmaps of that size. Originally I used smaller bitmaps when testing, but unfortunately we are able to create some quite large routes when coordinating sync points so this eventually breaks. -- 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]

