straighten out some whacky code

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@906086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2010-02-03 15:21:56 +00:00
parent 58bbab2827
commit 1444299662
1 changed files with 6 additions and 5 deletions

View File

@ -278,14 +278,15 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
try {
IndexDeletionPolicyWrapper delPolicy = core.getDeletionPolicy();
IndexCommit indexCommit = delPolicy.getLatestCommit();
// race?
delPolicy.setReserveDuration(indexCommit.getVersion(), reserveCommitDuration);
if(indexCommit == null) {
indexCommit = req.getSearcher().getReader().getIndexCommit();
// race?
delPolicy.setReserveDuration(indexCommit.getVersion(), reserveCommitDuration);
}
if (indexCommit != null) {
new SnapShooter(core, params.get("location")).createSnapAsync(indexCommit, this);
}
new SnapShooter(core, params.get("location")).createSnapAsync(indexCommit, this);
} catch (Exception e) {
LOG.warn("Exception during creating a snapshot", e);
rsp.add("exception", e);