mirror of https://github.com/apache/lucene.git
save the original index dir path, don't try to get it from the directory - it may be too late
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1424783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d34e50995a
commit
2d3b44c0e7
|
@ -300,6 +300,7 @@ public class SnapPuller {
|
|||
Directory tmpIndexDir = null;
|
||||
String tmpIndex = null;
|
||||
Directory indexDir = null;
|
||||
String indexDirPath = null;
|
||||
boolean deleteTmpIdxDir = true;
|
||||
try {
|
||||
//get the current 'replicateable' index version in the master
|
||||
|
@ -376,7 +377,8 @@ public class SnapPuller {
|
|||
tmpIndexDir = core.getDirectoryFactory().get(tmpIndex, core.getSolrConfig().indexConfig.lockType);
|
||||
|
||||
// make sure it's the newest known index dir...
|
||||
indexDir = core.getDirectoryFactory().get(core.getNewIndexDir(), core.getSolrConfig().indexConfig.lockType);
|
||||
indexDirPath = core.getNewIndexDir();
|
||||
indexDir = core.getDirectoryFactory().get(indexDirPath, core.getSolrConfig().indexConfig.lockType);
|
||||
Directory oldDirectory = null;
|
||||
|
||||
try {
|
||||
|
@ -425,12 +427,15 @@ public class SnapPuller {
|
|||
if (isFullCopyNeeded) {
|
||||
// we have to do this before commit
|
||||
final Directory freezeIndexDir = indexDir;
|
||||
final String freezeIndexDirPath = indexDirPath;
|
||||
core.getDirectoryFactory().addCloseListener(oldDirectory, new CloseListener(){
|
||||
|
||||
@Override
|
||||
public void preClose() {
|
||||
LOG.info("removing old index files " + freezeIndexDir);
|
||||
DirectoryFactory.empty(freezeIndexDir);
|
||||
if (core.getDirectoryFactory().exists(freezeIndexDirPath)) {
|
||||
DirectoryFactory.empty(freezeIndexDir);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue