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


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/IndexFileManager.java:
##########
@@ -207,15 +223,47 @@ private Path saveIndexMemtable(
             }
         }
 
-        return syncAndRename(tmpFilePath, 
tmpFilePath.resolveSibling(fileName));
+        syncAndRename(tmpFilePath, tmpFilePath.resolveSibling(fileName));
+
+        return fileHeaderWithIndexMetas.indexMetas();
     }
 
     /**
      * This method is intended to be called during {@link SegmentFileManager} 
recovery in order to create index files that may have been
      * lost due to a component stop before a checkpoint was able to complete.
      */
     void recoverIndexFile(ReadModeIndexMemTable indexMemTable, FileProperties 
fileProperties) throws IOException {
-        saveIndexMemtable(indexMemTable, fileProperties, true);
+        // On recovery we are only creating missing index files, in-memory 
meta will be created on Index File Manager start.
+        // (see recoverIndexFileMetas).
+        saveIndexMemtable(indexFilePath(fileProperties), indexMemTable, 
fileProperties);
+    }
+
+    Path onIndexFileCompacted(
+            ReadModeIndexMemTable indexMemTable,
+            FileProperties oldIndexFileProperties,
+            FileProperties newIndexFileProperties
+    ) throws IOException {
+        Path newIndexFilePath = indexFilePath(newIndexFileProperties);
+
+        List<IndexMetaSpec> metaSpecs = saveIndexMemtable(newIndexFilePath, 
indexMemTable, newIndexFileProperties);
+
+        metaSpecs.forEach(metaSpec -> {
+            GroupIndexMeta groupIndexMeta = 
groupIndexMetas.get(metaSpec.groupId);
+
+            IndexFileMeta meta = metaSpec.indexFileMeta();
+
+            if (groupIndexMeta != null && meta != null) {
+                groupIndexMeta.onIndexCompacted(oldIndexFileProperties, meta);
+            }
+        });
+
+        LOG.info("New index file created after compaction: {}.", 
newIndexFilePath);

Review Comment:
   `New index file created after compaction [path={}]` for example



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