diff --git a/CHANGES.txt b/CHANGES.txt index 87b44d6c6e0..a8d3c7d4075 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -145,6 +145,8 @@ New Features 32. SOLR-966: Enhance the map() function query to take in an optional default value (Noble Paul, shalin) +33. SOLR-820: Support replication on startup of master with new index. (Noble Paul, Akshay Ukey via shalin) + Optimizations ---------------------- diff --git a/src/java/org/apache/solr/handler/ReplicationHandler.java b/src/java/org/apache/solr/handler/ReplicationHandler.java index 6f10eac2d3b..66ce2ecb703 100644 --- a/src/java/org/apache/solr/handler/ReplicationHandler.java +++ b/src/java/org/apache/solr/handler/ReplicationHandler.java @@ -31,6 +31,7 @@ import org.apache.solr.request.BinaryQueryResponseWriter; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryResponse; import org.apache.solr.search.SolrIndexSearcher; +import org.apache.solr.update.DirectUpdateHandler2; import org.apache.solr.util.RefCounted; import org.apache.solr.util.plugin.SolrCoreAware; import org.slf4j.Logger; @@ -684,6 +685,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw if (replicateAfter.contains("startup")) { RefCounted s = core.getNewestSearcher(false); try { + if (core.getUpdateHandler() instanceof DirectUpdateHandler2) { + ((DirectUpdateHandler2) core.getUpdateHandler()).forceOpenWriter(); + } else { + LOG.warn("The update handler being used is not an instance or sub-class of DirectUpdateHandler2. " + + "Replicate on Startup cannot work."); + } indexCommitPoint = s.get().getReader().getIndexCommit(); } catch (IOException e) { LOG.warn("Unable to get IndexCommit on startup", e);