You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2016/12/29 10:41:33 UTC
[1/2] lucene-solr:master: SOLR-9902: StandardDirectoryFactory should
use Files API for it's move implementation.
Repository: lucene-solr
Updated Branches:
refs/heads/master 662be93ed -> a5e5c4a04
SOLR-9902: StandardDirectoryFactory should use Files API for it's move implementation.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2781145e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2781145e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2781145e
Branch: refs/heads/master
Commit: 2781145eb3760489922530fd92d5f1d4c35215a9
Parents: 662be93
Author: markrmiller <ma...@apache.org>
Authored: Thu Dec 29 05:29:51 2016 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Thu Dec 29 05:29:51 2016 -0500
----------------------------------------------------------------------
solr/CHANGES.txt | 1 +
.../solr/core/StandardDirectoryFactory.java | 20 +++++++++++---------
2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2781145e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 852a306..06566e0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -222,6 +222,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)
Bug Fixes
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2781145e/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
index b24be14..1d8793a 100644
--- a/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
@@ -129,13 +129,14 @@ public class StandardDirectoryFactory extends CachingDirectoryFactory {
Directory baseToDir = getBaseDir(toDir);
if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) {
- File dir1 = ((FSDirectory) baseFromDir).getDirectory().toFile();
- File dir2 = ((FSDirectory) baseToDir).getDirectory().toFile();
- File indexFileInTmpDir = new File(dir1, fileName);
- File indexFileInIndex = new File(dir2, fileName);
- boolean success = indexFileInTmpDir.renameTo(indexFileInIndex);
- if (success) {
- return;
+
+ Path path1 = ((FSDirectory) baseFromDir).getDirectory().toAbsolutePath();
+ Path path2 = ((FSDirectory) baseFromDir).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));
}
}
@@ -148,8 +149,9 @@ public class StandardDirectoryFactory extends CachingDirectoryFactory {
if (baseDir instanceof FSDirectory) {
Path path = ((FSDirectory) baseDir).getDirectory().toAbsolutePath();
try {
- Files.move(FileSystems.getDefault().getPath(path.toString(), fileName),
- FileSystems.getDefault().getPath(path.toString(), toName), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
+ Files.move(path.resolve(fileName),
+ path.resolve(toName), StandardCopyOption.ATOMIC_MOVE,
+ StandardCopyOption.REPLACE_EXISTING);
} catch (AtomicMoveNotSupportedException e) {
Files.move(FileSystems.getDefault().getPath(path.toString(), fileName),
FileSystems.getDefault().getPath(path.toString(), toName), StandardCopyOption.REPLACE_EXISTING);
[2/2] lucene-solr:master: tests: bump up fudge
Posted by ma...@apache.org.
tests: bump up fudge
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a5e5c4a0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a5e5c4a0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a5e5c4a0
Branch: refs/heads/master
Commit: a5e5c4a04385eb030aac1ec6126ff9b82407158f
Parents: 2781145
Author: markrmiller <ma...@apache.org>
Authored: Thu Dec 29 05:40:45 2016 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Thu Dec 29 05:40:45 2016 -0500
----------------------------------------------------------------------
solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a5e5c4a0/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
index 4106884..c9c9691 100644
--- a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
+++ b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
@@ -107,7 +107,7 @@ public class SoftAutoCommitTest extends AbstractSolrTestCase {
monitor.assertSaneOffers();
// Wait for the soft commit with some fudge
- Long soft529 = monitor.soft.poll(softCommitWaitMillis * 2, MILLISECONDS);
+ Long soft529 = monitor.soft.poll(softCommitWaitMillis * 3, MILLISECONDS);
assertNotNull("soft529 wasn't fast enough", soft529);
monitor.assertSaneOffers();