mirror of https://github.com/apache/lucene.git
SOLR-7358: TestRestoreCore fails in Windows
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1671858 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5aa3cbfb2d
commit
fe0ab10d4e
|
@ -104,6 +104,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
|
||||
|
|
|
@ -105,7 +105,7 @@ public class RestoreCore implements Callable<Boolean> {
|
|||
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,
|
||||
|
|
|
@ -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 SolrJettyTestBase {
|
|||
//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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue