Skip to content

Commit

Permalink
RATIS-2177. Purge should delete segmentLog from small to large accord…
Browse files Browse the repository at this point in the history
…ing to logIndex (#1174)
  • Loading branch information
133tosakarin authored Nov 10, 2024
1 parent e75a0d5 commit 26c1f04
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,10 @@ private PurgeLog(TruncationSegments segments) {
void execute() throws IOException {
if (segments.getToDelete() != null) {
try(UncheckedAutoCloseable ignored = raftLogMetrics.startPurgeTimer()) {
for (SegmentFileInfo fileInfo : segments.getToDelete()) {
final Path deleted = FileUtils.deleteFile(fileInfo.getFile(storage));
LOG.info("{}: Purged RaftLog segment: info={}, path={}", name, fileInfo, deleted);
SegmentFileInfo[] toDeletes = segments.getToDelete();
for (int i = toDeletes.length - 1; i >= 0; i--) {
final Path deleted = FileUtils.deleteFile(toDeletes[i].getFile(storage));
LOG.info("{}: Purged RaftLog segment: info={}, path={}", name, toDeletes[i], deleted);
}
}
}
Expand Down

0 comments on commit 26c1f04

Please sign in to comment.