tkalkirill commented on code in PR #4572: URL: https://github.com/apache/ignite-3/pull/4572#discussion_r1803018312
########## modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/server/AbstractCompactionKeyValueStorageTest.java: ########## @@ -894,6 +898,50 @@ void testRangeAfterSetCompactionRevisionButBeforeStartCompaction() { } } + @Test + void testReadOperationsFutureWithoutReadOperations() { + assertTrue(storage.readOperationsFuture(0).isDone()); + assertTrue(storage.readOperationsFuture(1).isDone()); + } + + /** + * Tests {@link KeyValueStorage#readOperationsFuture} as expected in use. + * <ul> + * <li>Create read operations, we only need cursors since reading one entry or a batch is synchronized with + * {@link KeyValueStorage#setCompactionRevision}.</li> + * <li>Set a new compaction revision via {@link KeyValueStorage#setCompactionRevision}.</li> + * <li>Wait for the completion of read operations on the new compaction revision.</li> + * </ul> + * + * <p>The keys are chosen randomly. Keys with their revisions are added in {@link #setUp()}.</p> + */ + @Test + void testReadOperationsFuture() throws Exception { + Cursor<Entry> range0 = storage.range(FOO_KEY, FOO_KEY); + Cursor<Entry> range1 = storage.range(BAR_KEY, BAR_KEY, 5); + + try { + storage.setCompactionRevision(3); + + CompletableFuture<Void> readOperationsFuture = storage.readOperationsFuture(3); Review Comment: Adds test -- 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