You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2015/04/07 21:14:41 UTC
svn commit: r1671926 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/handler/RestoreCore.java
solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
Author: varun
Date: Tue Apr 7 19:14:41 2015
New Revision: 1671926
URL: http://svn.apache.org/r1671926
Log:
SOLR-7358: TestRestoreCore fails in Windows (merged from trunk r1671858)
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1671926&r1=1671925&r2=1671926&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Tue Apr 7 19:14:41 2015
@@ -55,6 +55,8 @@ Other Changes
* SOLR-6865: Upgrade HttpClient to 4.4.1 (Shawn Heisey)
+* SOLR-7358: TestRestoreCore fails in Windows (Ishan Chattopadhyaya via Varun Thacker)
+
================== 5.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/RestoreCore.java?rev=1671926&r1=1671925&r2=1671926&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/RestoreCore.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/RestoreCore.java Tue Apr 7 19:14:41 2015
@@ -108,7 +108,7 @@ public class RestoreCore implements Call
log.info("Successfully restored to the backup index");
} catch (Exception e) {
//Rollback to the old index directory. Delete the restore index directory and mark the restore as failed.
- log.info("Could not switch to restored index. Rolling back to the current index");
+ log.warn("Could not switch to restored index. Rolling back to the current index");
Directory dir = null;
try {
dir = core.getDirectoryFactory().get(core.getDataDir(), DirectoryFactory.DirContext.META_DATA,
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java?rev=1671926&r1=1671925&r2=1671926&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java Tue Apr 7 19:14:41 2015
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLEncoder;
+import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -186,8 +187,10 @@ public class TestRestoreCore extends Sol
//Remove the segments_n file so that the backup index is corrupted.
//Restore should fail and it should automatically rollback to the original index.
Path restoreIndexPath = Paths.get(location, "snapshot." + snapshotName);
- Path segmentFileName = Files.newDirectoryStream(restoreIndexPath, IndexFileNames.SEGMENTS + "*").iterator().next();
- Files.delete(segmentFileName);
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(restoreIndexPath, IndexFileNames.SEGMENTS + "*")) {
+ Path segmentFileName = stream.iterator().next();
+ Files.delete(segmentFileName);
+ }
TestReplicationHandlerBackup.runBackupCommand(masterJetty, ReplicationHandler.CMD_RESTORE, params);