mirror of https://github.com/apache/lucene.git
SOLR-9902: Fix move impl.
This commit is contained in:
parent
25290ab5d6
commit
8bc151d1c6
|
@ -248,7 +248,7 @@ Optimizations
|
||||||
resulting in less produced garbage and 5-7% better performance.
|
resulting in less produced garbage and 5-7% better performance.
|
||||||
(yonik)
|
(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
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -131,13 +131,14 @@ public class StandardDirectoryFactory extends CachingDirectoryFactory {
|
||||||
if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) {
|
if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) {
|
||||||
|
|
||||||
Path path1 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
|
Path path1 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
|
||||||
Path path2 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
|
Path path2 = ((FSDirectory) baseToDir).getDirectory().toAbsolutePath();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.move(path1.resolve(fileName), path2.resolve(fileName), StandardCopyOption.ATOMIC_MOVE);
|
Files.move(path1.resolve(fileName), path2.resolve(fileName), StandardCopyOption.ATOMIC_MOVE);
|
||||||
} catch (AtomicMoveNotSupportedException e) {
|
} catch (AtomicMoveNotSupportedException e) {
|
||||||
Files.move(path1.resolve(fileName), path2.resolve(fileName));
|
Files.move(path1.resolve(fileName), path2.resolve(fileName));
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.move(fromDir, toDir, fileName, ioContext);
|
super.move(fromDir, toDir, fileName, ioContext);
|
||||||
|
|
Loading…
Reference in New Issue