Apache Solr open-source search software
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.
Mark Robert Millerce3f9caf86ef
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.javaindex 097686ee85f..68ea6e5dcd1 100644--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java@@ -133,7 +133,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAwif (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