Apache Lucene open-source search software
only try and clear the tmp directory if it exists
Mark Robert Milleraa0958f7359e
diff --git a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java b/solr/core/src/java/org/apache/solr/handler/SnapPuller.javaindex 7f42e012131..aa8c87d1a56 100644--- a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java+++ b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java@@ -296,6 +296,7 @@ public class SnapPuller {successfulInstall = false;replicationStartTime = System.currentTimeMillis();Directory tmpIndexDir = null;+ String tmpIndex = null;Directory indexDir = null;boolean deleteTmpIdxDir = true;try {@@ -368,7 +369,7 @@ public class SnapPuller {boolean isFullCopyNeeded = IndexDeletionPolicyWrapper.getCommitTimestamp(commit) >= latestVersion || forceReplication;String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());- String tmpIndex = createTempindexDir(core, tmpIdxDirName);+ tmpIndex = createTempindexDir(core, tmpIdxDirName);tmpIndexDir = core.getDirectoryFactory().get(tmpIndex, null);@@ -466,7 +467,9 @@ public class SnapPuller {} finally {if (deleteTmpIdxDir) {LOG.info("removing temporary index download directory files " + tmpIndexDir);- DirectoryFactory.empty(tmpIndexDir);+ if (tmpIndex != null && core.getDirectoryFactory().exists(tmpIndex)) {+ DirectoryFactory.empty(tmpIndexDir);+ }}}} finally {