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;
|
Directory tmpIndexDir = null;
|
||||||
String tmpIndex = null;
|
String tmpIndex = null;
|
||||||
Directory indexDir = null;
|
Directory indexDir = null;
|
||||||
|
String indexDirPath = null;
|
||||||
boolean deleteTmpIdxDir = true;
|
boolean deleteTmpIdxDir = true;
|
||||||
try {
|
try {
|
||||||
//get the current 'replicateable' index version in the master
|
//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);
|
tmpIndexDir = core.getDirectoryFactory().get(tmpIndex, core.getSolrConfig().indexConfig.lockType);
|
||||||
|
|
||||||
// make sure it's the newest known index dir...
|
// 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;
|
Directory oldDirectory = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -425,13 +427,16 @@ public class SnapPuller {
|
||||||
if (isFullCopyNeeded) {
|
if (isFullCopyNeeded) {
|
||||||
// we have to do this before commit
|
// we have to do this before commit
|
||||||
final Directory freezeIndexDir = indexDir;
|
final Directory freezeIndexDir = indexDir;
|
||||||
|
final String freezeIndexDirPath = indexDirPath;
|
||||||
core.getDirectoryFactory().addCloseListener(oldDirectory, new CloseListener(){
|
core.getDirectoryFactory().addCloseListener(oldDirectory, new CloseListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preClose() {
|
public void preClose() {
|
||||||
LOG.info("removing old index files " + freezeIndexDir);
|
LOG.info("removing old index files " + freezeIndexDir);
|
||||||
|
if (core.getDirectoryFactory().exists(freezeIndexDirPath)) {
|
||||||
DirectoryFactory.empty(freezeIndexDir);
|
DirectoryFactory.empty(freezeIndexDir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postClose() {
|
public void postClose() {
|
||||||
|
|
Loading…
Reference in New Issue