133tosakarin commented on code in PR #1174:
URL: https://github.com/apache/ratis/pull/1174#discussion_r1835276603


##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java:
##########
@@ -694,7 +695,9 @@ void execute() throws IOException {
 
       if (segments.getToDelete() != null && segments.getToDelete().length > 0) 
{
         long minStart = segments.getToDelete()[0].getStartIndex();
-        for (SegmentFileInfo del : segments.getToDelete()) {
+        SegmentFileInfo[] toDelete = segments.getToDelete();
+        for (int i = toDelete.length - 1; i >= 0; i--) {
+          final SegmentFileInfo del = toDelete[i];

Review Comment:
   Deleting from high to low may cause gaps, such as power outages, kill -9, 
etc. during the deletion process.



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