mirror of https://github.com/apache/lucene.git
SOLR-978 -- Old files are not removed from slaves after replication
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@737550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
645cb098f5
commit
b822a6db8b
|
@ -219,6 +219,8 @@ Bug Fixes
|
||||||
24. SOLR-902: FastInputStream#read(byte b[], int off, int len) gives incorrect results when amount left to read is less
|
24. SOLR-902: FastInputStream#read(byte b[], int off, int len) gives incorrect results when amount left to read is less
|
||||||
than buffer size (Noble Paul via shalin)
|
than buffer size (Noble Paul via shalin)
|
||||||
|
|
||||||
|
25. SOLR-978: Old files are not removed from slaves after replication (Jaco, Noble Paul, shalin)
|
||||||
|
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.solr.core.SolrCore;
|
||||||
import static org.apache.solr.handler.ReplicationHandler.*;
|
import static org.apache.solr.handler.ReplicationHandler.*;
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
import org.apache.solr.update.CommitUpdateCommand;
|
import org.apache.solr.update.CommitUpdateCommand;
|
||||||
|
import org.apache.solr.update.DirectUpdateHandler2;
|
||||||
import org.apache.solr.util.RefCounted;
|
import org.apache.solr.util.RefCounted;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -281,14 +282,14 @@ public class SnapPuller {
|
||||||
replicationStartTime = 0;
|
replicationStartTime = 0;
|
||||||
return successfulInstall;
|
return successfulInstall;
|
||||||
} catch (ReplicationHandlerException e) {
|
} catch (ReplicationHandlerException e) {
|
||||||
delTree(tmpIndexDir);
|
|
||||||
LOG.error("User aborted Replication");
|
LOG.error("User aborted Replication");
|
||||||
} catch (SolrException e) {
|
} catch (SolrException e) {
|
||||||
delTree(tmpIndexDir);
|
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
delTree(tmpIndexDir);
|
delTree(tmpIndexDir);
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Snappull failed : ", e);
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Snappull failed : ", e);
|
||||||
|
} finally {
|
||||||
|
delTree(tmpIndexDir);
|
||||||
}
|
}
|
||||||
return successfulInstall;
|
return successfulInstall;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -349,6 +350,14 @@ public class SnapPuller {
|
||||||
cmd.waitFlush = true;
|
cmd.waitFlush = true;
|
||||||
cmd.waitSearcher = true;
|
cmd.waitSearcher = true;
|
||||||
solrCore.getUpdateHandler().commit(cmd);
|
solrCore.getUpdateHandler().commit(cmd);
|
||||||
|
if (solrCore.getUpdateHandler() instanceof DirectUpdateHandler2) {
|
||||||
|
LOG.info("Force open index writer to make sure older index files get deleted");
|
||||||
|
DirectUpdateHandler2 handler = (DirectUpdateHandler2) solrCore.getUpdateHandler();
|
||||||
|
handler.forceOpenWriter();
|
||||||
|
} else {
|
||||||
|
LOG.warn("The update handler is not an instance or sub-class of DirectUpdateHandler2. " +
|
||||||
|
"ReplicationHandler may not be able to cleanup un-used index files.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,14 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceOpenWriter() throws IOException {
|
||||||
|
iwCommit.lock();
|
||||||
|
try {
|
||||||
|
openWriter();
|
||||||
|
} finally {
|
||||||
|
iwCommit.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void commit(CommitUpdateCommand cmd) throws IOException {
|
public void commit(CommitUpdateCommand cmd) throws IOException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue