SOLR-1315 backup command should work when there was no commit/optimize since startup

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@805675 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2009-08-19 06:29:26 +00:00
parent 3330f98584
commit 462571235e
1 changed files with 5 additions and 2 deletions

View File

@ -131,7 +131,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
} else if (command.equals(CMD_GET_FILE_LIST)) {
getFileList(solrParams, rsp);
} else if (command.equalsIgnoreCase(CMD_BACKUP)) {
doSnapShoot(new ModifiableSolrParams(solrParams), rsp);
doSnapShoot(new ModifiableSolrParams(solrParams), rsp,req);
rsp.add(STATUS, OK_STATUS);
} else if (command.equalsIgnoreCase(CMD_FETCH_INDEX)) {
String masterUrl = solrParams.get(MASTER_URL);
@ -268,9 +268,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
return snapPullLock.isLocked();
}
private void doSnapShoot(SolrParams params, SolrQueryResponse rsp) {
private void doSnapShoot(SolrParams params, SolrQueryResponse rsp, SolrQueryRequest req) {
try {
IndexCommit indexCommit = core.getDeletionPolicy().getLatestCommit();
if(indexCommit == null) {
indexCommit = req.getSearcher().getReader().getIndexCommit();
}
if (indexCommit != null) {
new SnapShooter(core, params.get("location")).createSnapAsync(indexCommit.getFileNames(), this);
}