sashapolo commented on code in PR #7610:
URL: https://github.com/apache/ignite-3/pull/7610#discussion_r2847033841


##########
modules/raft/src/test/java/org/apache/ignite/internal/raft/storage/segstore/GroupIndexMetaTest.java:
##########
@@ -277,4 +279,145 @@ void 
testTruncatePrefixRemovesAllEntriesWhenKeptAfterLast() {
         assertThat(groupMeta.indexMeta(19), is(nullValue()));
         assertThat(groupMeta.firstLogIndexInclusive(), is(-1L));
     }
+
+    @Test
+    void testOnIndexCompacted() {
+        var meta1 = new IndexFileMeta(1, 50, 0, new FileProperties(0));
+        var meta2 = new IndexFileMeta(50, 100, 42, new FileProperties(1));
+        var meta3 = new IndexFileMeta(100, 150, 84, new FileProperties(2));
+
+        var groupMeta = new GroupIndexMeta(meta1);
+        groupMeta.addIndexMeta(meta2);
+        groupMeta.addIndexMeta(meta3);
+
+        var compactedMeta2 = new IndexFileMeta(50, 100, 42, new 
FileProperties(1, 1));
+        groupMeta.onIndexCompacted(new FileProperties(1), compactedMeta2);
+
+        assertThat(groupMeta.indexMeta(1), is(meta1));
+        assertThat(groupMeta.indexMeta(50), is(compactedMeta2));
+        assertThat(groupMeta.indexMeta(100), is(meta3));
+    }
+
+    @Test
+    void testOnIndexRemoved() {
+        var meta1 = new IndexFileMeta(1, 50, 0, new FileProperties(0));
+        var meta2 = new IndexFileMeta(50, 100, 42, new FileProperties(1));
+        var meta3 = new IndexFileMeta(100, 150, 84, new FileProperties(2));
+
+        var groupMeta = new GroupIndexMeta(meta1);
+        groupMeta.addIndexMeta(meta2);
+        groupMeta.addIndexMeta(meta3);
+
+        groupMeta.onIndexRemoved(new FileProperties(1));
+
+        assertThat(groupMeta.indexMeta(1), is(meta1));
+        assertThat(groupMeta.indexMeta(50), is(nullValue()));
+        assertThat(groupMeta.indexMeta(99), is(nullValue()));

Review Comment:
   This is a unit test of a particular class which does not know about these 
Raft log semantics. I'll add a check to verify that we can only remove index 
files from the "tail" of the queue, if that's important.



-- 
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]

Reply via email to