rpuch commented on code in PR #2991: URL: https://github.com/apache/ignite-3/pull/2991#discussion_r1444458053
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/TxRwOperationCounter.java: ########## @@ -0,0 +1,67 @@ +/* + * 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.ignite.internal.table.distributed.replicator; + +import java.util.concurrent.CompletableFuture; + +/** + * Helper class for counting the number of RW transactions operations. + * + * <p>{@link #operationsFuture()} needs to be completed from the outside.</p> + */ +class TxRwOperationCounter { + private final long operationCount; Review Comment: It looks like the issue here is that with the current 'immutable' approach we are ok with the 'reached 0' future completing too optimistically (if the counter goes up again, this will be another object, so at the waiting side, we'll first reach the 'no increments are possible' state and only then we'll look at the futures). On the other hand, with the 'mutable' approach we wouldn't be able to complete the 'reached 0' future before we are sure that it can never increment again, so the control logic would become more difficult. We agreed to leave it as is for now and revisit the issue if it's demonstrated with a profiler that we have problems due to excessive GC pressure (because of additional allocations). -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org