SOLR-6637: can't assume a local filesystem when dealing with paths

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1672620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Varun Thacker 2015-04-10 11:52:43 +00:00
parent a2d29b8e12
commit 3464197249
4 changed files with 6 additions and 6 deletions

View File

@ -356,7 +356,7 @@ public class IndexFetcher {
|| commit.getGeneration() >= latestGeneration || forceReplication;
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());
tmpIndex = Paths.get(solrCore.getDataDir(), tmpIdxDirName).toString();
tmpIndex = solrCore.getDataDir() + tmpIdxDirName;
tmpIndexDir = solrCore.getDirectoryFactory().get(tmpIndex, DirContext.DEFAULT, solrCore.getSolrConfig().indexConfig.lockType);

View File

@ -55,15 +55,15 @@ public class RestoreCore implements Callable<Boolean> {
private boolean doRestore() throws Exception {
Path backupPath = Paths.get(backupLocation, backupName);
Path backupPath = Paths.get(backupLocation).resolve(backupName);
String restoreIndexName = "restore." + backupName;
Path restoreIndexPath = Paths.get(core.getDataDir(), restoreIndexName);
String restoreIndexPath = core.getDataDir() + restoreIndexName;
Directory restoreIndexDir = null;
Directory indexDir = null;
try (Directory backupDir = FSDirectory.open(backupPath)) {
restoreIndexDir = core.getDirectoryFactory().get(restoreIndexPath.toString(),
restoreIndexDir = core.getDirectoryFactory().get(restoreIndexPath,
DirectoryFactory.DirContext.DEFAULT, core.getSolrConfig().indexConfig.lockType);
//Prefer local copy.

View File

@ -1274,7 +1274,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
masterClient.close();
masterJetty.stop();
Directory dir = FSDirectory.open(Paths.get(dataDir, "index"));
Directory dir = FSDirectory.open(Paths.get(dataDir).resolve("index"));
String[] files = dir.listAll();
long totalBytes = 0;
for(String file : files) {

View File

@ -186,7 +186,7 @@ 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 restoreIndexPath = Paths.get(location).resolve("snapshot." + snapshotName);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(restoreIndexPath, IndexFileNames.SEGMENTS + "*")) {
Path segmentFileName = stream.iterator().next();
Files.delete(segmentFileName);