SOLR-9902: Fix move impl.

This commit is contained in:
markrmiller 2017-01-08 10:22:42 -05:00
parent 25290ab5d6
commit 8bc151d1c6
2 changed files with 3 additions and 2 deletions

View File

@ -248,7 +248,7 @@ Optimizations
resulting in less produced garbage and 5-7% better performance.
(yonik)
* SOLR-9902: StandardDirectoryFactory should use Files API for it's move implementation. (Mark Miller)
* SOLR-9902: StandardDirectoryFactory should use Files API for it's move implementation. (Mark Miller, Mike Drob)
Bug Fixes
----------------------

View File

@ -131,13 +131,14 @@ public class StandardDirectoryFactory extends CachingDirectoryFactory {
if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) {
Path path1 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
Path path2 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
Path path2 = ((FSDirectory) baseToDir).getDirectory().toAbsolutePath();
try {
Files.move(path1.resolve(fileName), path2.resolve(fileName), StandardCopyOption.ATOMIC_MOVE);
} catch (AtomicMoveNotSupportedException e) {
Files.move(path1.resolve(fileName), path2.resolve(fileName));
}
return;
}
super.move(fromDir, toDir, fileName, ioContext);