tkalkirill commented on code in PR #7198:
URL: https://github.com/apache/ignite-3/pull/7198#discussion_r2609664926


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/SegmentInfo.java:
##########
@@ -299,6 +304,18 @@ SegmentInfo truncatePrefix(long firstIndexKept) {
         return new SegmentInfo(firstIndexKept, firstIndexKept, 
segmentFileOffsets.truncatePrefix(newSize));
     }
 
+    SegmentInfo reset(long nextLogIndex) {
+        assert nextLogIndex > logIndexBase : String.format("nextLogIndex=%d, 
logIndexBase=%d", nextLogIndex, logIndexBase);
+
+        int nextOffsetIndex = toIntExact(nextLogIndex - logIndexBase);
+
+        int offsetToKeep = segmentFileOffsets.get(nextOffsetIndex);

Review Comment:
   Offset in the segment file?
   The segment file can't be expanded beyond `int`, even if we really want to?



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/SegmentInfo.java:
##########
@@ -299,6 +304,18 @@ SegmentInfo truncatePrefix(long firstIndexKept) {
         return new SegmentInfo(firstIndexKept, firstIndexKept, 
segmentFileOffsets.truncatePrefix(newSize));
     }
 
+    SegmentInfo reset(long nextLogIndex) {
+        assert nextLogIndex > logIndexBase : String.format("nextLogIndex=%d, 
logIndexBase=%d", nextLogIndex, logIndexBase);
+
+        int nextOffsetIndex = toIntExact(nextLogIndex - logIndexBase);
+
+        int offsetToKeep = segmentFileOffsets.get(nextOffsetIndex);
+
+        ArrayWithSize newSegmentFileOffsets = new 
ArrayWithSize().add(offsetToKeep);

Review Comment:
   ```suggestion
           var newSegmentFileOffsets = new ArrayWithSize().add(offsetToKeep);
   ```



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