Skip to content

Commit e030dd5

Browse files
committed
don't log delete of unused shard location if it does not exists
1 parent c5dbede commit e030dd5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/indices/store/IndicesStore.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@ public void close() {
131131
}
132132
if (shardCanBeDeleted) {
133133
ShardId shardId = indexShardRoutingTable.shardId();
134-
logger.debug("[{}][{}] deleting shard that is no longer used", shardId.index().name(), shardId.id());
135-
FileSystemUtils.deleteRecursively(nodeEnv.shardLocation(shardId));
134+
File shardLocation = nodeEnv.shardLocation(shardId);
135+
if (shardLocation.exists()) {
136+
logger.debug("[{}][{}] deleting shard that is no longer used", shardId.index().name(), shardId.id());
137+
FileSystemUtils.deleteRecursively(shardLocation);
138+
}
136139
}
137140
}
138141
}

0 commit comments

Comments
 (0)