Apache Lucene open-source search software
SOLR-8656: PeerSync should use same nUpdates everywhere.
markrmiller771f14cb6e47
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 035a1f6af3f..e0901268b79 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -190,6 +190,8 @@ Bug Fixes* SOLR-8633: DistributedUpdateProcess processCommit/deleteByQuery call finish on DUP andSolrCmdDistributor, which violates the lifecycle and can cause bugs. (hossman via Mark Miller)++* SOLR-8656: PeerSync should use same nUpdates everywhere. (Ramsey Haddad via Mark Miller)Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.javaindex 28b81bd4c76..cedcff9ece7 100644--- a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java+++ b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java@@ -141,7 +141,7 @@ public class SyncStrategy {if (success) {log.info("Sync Success - now sync replicas to me");- syncToMe(zkController, collection, shardId, leaderProps, core.getCoreDescriptor());+ syncToMe(zkController, collection, shardId, leaderProps, core.getCoreDescriptor(), core.getUpdateHandler().getUpdateLog().getNumRecordsToKeep());} else {log.info("Leader's attempt to sync with shard failed, moving to the next candidate");@@ -181,7 +181,8 @@ public class SyncStrategy {}private void syncToMe(ZkController zkController, String collection,- String shardId, ZkNodeProps leaderProps, CoreDescriptor cd) {+ String shardId, ZkNodeProps leaderProps, CoreDescriptor cd,+ int nUpdates) {// sync everyone else// TODO: we should do this in parallel at least@@ -199,7 +200,7 @@ public class SyncStrategy {try {log.info(ZkCoreNodeProps.getCoreUrl(leaderProps) + ": try and ask " + node.getCoreUrl() + " to sync");- requestSync(node.getBaseUrl(), node.getCoreUrl(), zkLeader.getCoreUrl(), node.getCoreName());+ requestSync(node.getBaseUrl(), node.getCoreUrl(), zkLeader.getCoreUrl(), node.getCoreName(), nUpdates);} catch (Exception e) {SolrException.log(log, "Error syncing replica to leader", e);@@ -250,7 +251,7 @@ public class SyncStrategy {return success;}- private void requestSync(String baseUrl, String replica, String leaderUrl, String coreName) {+ private void requestSync(String baseUrl, String replica, String leaderUrl, String coreName, int nUpdates) {ShardCoreRequest sreq = new ShardCoreRequest();sreq.coreName = coreName;sreq.baseUrl = baseUrl;@@ -260,7 +261,7 @@ public class SyncStrategy {sreq.params = new ModifiableSolrParams();sreq.params.set("qt","/get");sreq.params.set("distrib",false);- sreq.params.set("getVersions",Integer.toString(100));+ sreq.params.set("getVersions",Integer.toString(nUpdates));sreq.params.set("sync",leaderUrl);shardHandler.submit(sreq, replica, sreq.params);