SOLR-3082: If you use a lazy replication request handler, the commit listener will not be registered right away, and might miss tracking the last commit.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1240233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-02-03 16:26:20 +00:00
parent 1b4c60816c
commit ce3f9caf86
1 changed files with 6 additions and 1 deletions

View File

@ -133,7 +133,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
if (command.equals(CMD_INDEX_VERSION)) {
IndexCommit commitPoint = indexCommitPoint; // make a copy so it won't change
//System.out.println("The latest index gen is:" + commitPoint.getGeneration() + " " + core.getCoreDescriptor().getCoreContainer().getZkController().getNodeName());
if (commitPoint == null) {
// if this handler is 'lazy', we may not have tracked the last commit
// because our commit listener is registered on inform
commitPoint = core.getDeletionPolicy().getLatestCommit();
}
if (commitPoint != null && replicationEnabled.get()) {
//
// There is a race condition here. The commit point may be changed / deleted by the time