rpuch commented on code in PR #5670: URL: https://github.com/apache/ignite-3/pull/5670#discussion_r2055387081
########## modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/ReadOperationForCompactionTracker.java: ########## @@ -48,56 +50,82 @@ public class ReadOperationForCompactionTracker { private final AtomicLong longOperationIdGenerator = new AtomicLong(); - /** Generates the next read operation ID. Thread-safe. */ - public long generateReadOperationId() { - return longOperationIdGenerator.getAndIncrement(); + /** + * Token to stop tracking the read operation. + * + * @see #track(long, LongSupplier, LongSupplier) + */ + @FunctionalInterface + public interface TrackingToken extends AutoCloseable { + @Override + void close(); } /** * Starts tracking the completion of a read operation on its lowest estimation for revision upper bound. * - * <p>Method is expected not to be called more than once for the same arguments.</p> - * * <p>Expected usage pattern:</p> * <pre><code> - * Object readOperationId = ...; * int operationRevision = ...; * - * tracker.track(readOperationId, operationRevision); - * - * try { + * try (var token = tracker.track(operationRevision, storage::revision, storage::getCompactionRevision)) { Review Comment: No, it's a mistake from my side. I added a comment, then added this one as a follow-up, then I realized the original comment was wrong and deleted it, but forgot to remove this one -- 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