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


##########
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:
   Formally this is not legal according to the code style, see `add`



##########
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:
   Formally this is not legal according to the code style, see 
`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