File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
server/src/main/java/org/opensearch/index/shard Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,17 @@ private synchronized void syncSegments(boolean isRetry) {
224
224
// Each metadata file in the remote segment store represents a commit and the following
225
225
// statement keeps sure that each metadata will always contain all the segments from last commit + refreshed
226
226
// segments.
227
- localSegmentsPostRefresh .addAll (SegmentInfos .readCommit (storeDirectory , latestSegmentInfos .get ()).files (true ));
227
+ SegmentInfos segmentCommitInfos ;
228
+ try {
229
+ segmentCommitInfos = SegmentInfos .readCommit (storeDirectory , latestSegmentInfos .get ());
230
+ } catch (Exception e ) {
231
+ // Seeing discrepancy in segment infos and files on disk. SegmentInfosSnapshot is returning
232
+ // a segment_N file which does not exist on local disk.
233
+ logger .error ("Exception occurred while SegmentInfos.readCommit(..)" , e );
234
+ logger .error ("segmentInfosFiles={} diskFiles={}" , localSegmentsPostRefresh , storeDirectory .listAll ());
235
+ throw e ;
236
+ }
237
+ localSegmentsPostRefresh .addAll (segmentCommitInfos .files (true ));
228
238
segmentInfosFiles .stream ()
229
239
.filter (file -> !file .equals (latestSegmentInfos .get ()))
230
240
.forEach (localSegmentsPostRefresh ::remove );
You can’t perform that action at this time.
0 commit comments