Skip to content

Commit

Permalink
Add logs to debug NoSuchFileException during segments upload (#8475)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 authored Jul 6, 2023
1 parent eca5a6c commit c1c23b4
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,17 @@ private synchronized void syncSegments(boolean isRetry) {
// Each metadata file in the remote segment store represents a commit and the following
// statement keeps sure that each metadata will always contain all the segments from last commit + refreshed
// segments.
localSegmentsPostRefresh.addAll(SegmentInfos.readCommit(storeDirectory, latestSegmentInfos.get()).files(true));
SegmentInfos segmentCommitInfos;
try {
segmentCommitInfos = SegmentInfos.readCommit(storeDirectory, latestSegmentInfos.get());
} catch (Exception e) {
// Seeing discrepancy in segment infos and files on disk. SegmentInfosSnapshot is returning
// a segment_N file which does not exist on local disk.
logger.error("Exception occurred while SegmentInfos.readCommit(..)", e);
logger.error("segmentInfosFiles={} diskFiles={}", localSegmentsPostRefresh, storeDirectory.listAll());
throw e;
}
localSegmentsPostRefresh.addAll(segmentCommitInfos.files(true));
segmentInfosFiles.stream()
.filter(file -> !file.equals(latestSegmentInfos.get()))
.forEach(localSegmentsPostRefresh::remove);
Expand Down

0 comments on commit c1c23b4

Please sign in to comment.