ibessonov commented on code in PR #5654: URL: https://github.com/apache/ignite-3/pull/5654#discussion_r2048476011
########## modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/server/AbstractCompactionKeyValueStorageTest.java: ########## @@ -1086,6 +1093,154 @@ void testUpdateCompactionRevision() { assertEquals(1, storage.getCompactionRevision()); } + @Test + void testConcurrentReadAndCompaction() { + KeyValueUpdateContext context = kvContext(hybridTimestamp(10L)); + + for (int i = 0; i < 1000; i++) { + byte[] key = key(i); + byte[] value = keyValue(i, i); + + storage.put(key, value, context); + long revision = storage.revision(); + storage.remove(key, context); + + runRace( + () -> { + storage.setCompactionRevision(revision); + storage.compact(revision); + }, + () -> { + for (int j = 0; j < 1000; j++) { + try { + Entry entry = storage.get(key, revision); + + assertEquals(revision, entry.revision()); + assertArrayEquals(value, entry.value()); + } catch (CompactedException ignore) { + // Expected outcome. Loop can be stopped. + return; + } + } + } + ); + } + } + + @Test + void testConcurrentReadAllAndCompaction() { + KeyValueUpdateContext context = kvContext(hybridTimestamp(10L)); + + int numberOfKeys = 100; + for (int i = 0; i < 100; i++) { + List<byte[]> keys = new ArrayList<>(); Review Comment: I know, but I don't want to :) -- 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