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


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/SegmentInfo.java:
##########
@@ -159,4 +172,23 @@ void saveOffsetsTo(ByteBuffer buffer) {
 
         buffer.asIntBuffer().put(offsets.array, 0, offsets.size);
     }
+
+    void truncateSuffix(long lastLogIndexKept) {
+        ArrayWithSize segmentFileOffsets = this.segmentFileOffsets;
+
+        long newSize = max(lastLogIndexKept - logIndexBase + 1, 0);
+
+        if (newSize >= segmentFileOffsets.size()) {
+            // Nothing to truncate.
+            return;
+        }
+
+        ArrayWithSize newSegmentFileOffsets = 
segmentFileOffsets.truncate((int) newSize);

Review Comment:
   no, that's exactly why I didn't use `copyOfRange` =)



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