Replace FileUtils.delete with FileUtils.deleteQuitely to expand compatibility
@@ -124,7 +124,10 @@ public class ImmutableSegmentImpl implements ImmutableSegment {
File validDocIdsSnapshotFile = getValidDocIdsSnapshotFile();
try {
if (validDocIdsSnapshotFile.exists()) {
- FileUtils.delete(validDocIdsSnapshotFile);
+ if (!FileUtils.deleteQuietly(validDocIdsSnapshotFile)) {
+ LOGGER.warn("Cannot delete old valid doc ids snapshot file: {}, skipping", validDocIdsSnapshotFile);
+ return;
+ }
}
try (DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(validDocIdsSnapshotFile))) {
validDocIds.serialize(dataOutputStream);
@@ -141,7 +144,10 @@ public class ImmutableSegmentImpl implements ImmutableSegment {
File validDocIdsSnapshotFile = getValidDocIdsSnapshotFile();
if (validDocIdsSnapshotFile.exists()) {
try {
- FileUtils.delete(validDocIdsSnapshotFile);
+ if (!FileUtils.deleteQuietly(validDocIdsSnapshotFile)) {
+ LOGGER.warn("Cannot delete old valid doc ids snapshot file: {}, skipping", validDocIdsSnapshotFile);
+ return;
+ }
LOGGER.info("Deleted valid doc ids snapshot for segment: {}", getSegmentName());
} catch (Exception e) {
LOGGER.warn("Caught exception while deleting valid doc ids snapshot file: {}, skipping",
