1) Try checking for parent dirs first and creating if they aren't there when moving files from the legacy directory to the new one.

This commit is contained in:
Eric Tschetter 2013-03-18 17:04:11 -05:00
parent cba404a65d
commit 57f52f71fc
1 changed files with 8 additions and 1 deletions

View File

@ -82,8 +82,15 @@ public class SingleSegmentLoader implements SegmentLoader
throw new SegmentLoadingException(e, "Error deleting localDir[%s]", localStorageDir);
}
}
final File parentDir = localStorageDir.getParentFile();
if (!parentDir.exists()) {
log.info("Parent[%s] didn't exist, creating.");
parentDir.mkdirs();
}
legacyStorageDir.renameTo(localStorageDir);
if (!legacyStorageDir.renameTo(localStorageDir)) {
log.info("Failed moving [%s] to [%s]", legacyStorageDir, localStorageDir);
}
}
}