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


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/IndexMemTable.java:
##########
@@ -64,6 +64,22 @@ public SegmentInfo segmentInfo(long groupId) {
         return stripe(groupId).memTable.get(groupId);
     }
 
+    @Override
+    public void truncateSuffix(long groupId, long lastLogIndexKept) {
+        ConcurrentMap<Long, SegmentInfo> memtable = stripe(groupId).memTable;
+
+        SegmentInfo segmentInfo = memtable.get(groupId);
+
+        if (segmentInfo == null || lastLogIndexKept < 
segmentInfo.firstLogIndexInclusive()) {
+            // If the current memtable does not have information for the given 
group or if we are truncating everything currently present
+            // in the memtable, we need to write a special "empty" SegmentInfo 
into the memtable to override existing persisted data during
+            // search.
+            memtable.put(groupId, new SegmentInfo(lastLogIndexKept + 1));

Review Comment:
   Otherwise it's hard for me personally to justify the "need" to replace the 
old array with a new one, maybe I'm missing something



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