You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2016/04/21 20:23:43 UTC

[3/3] lucene-solr:branch_5x: SOLR-8656: PeerSync should use same nUpdates everywhere.

SOLR-8656: PeerSync should use same nUpdates everywhere.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d2f68e13
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d2f68e13
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d2f68e13

Branch: refs/heads/branch_5x
Commit: d2f68e13c660291f460b4b5e54c8a95643497eea
Parents: 30fee6b
Author: markrmiller <ma...@apache.org>
Authored: Fri Feb 19 16:41:49 2016 -0500
Committer: anshum <an...@apache.org>
Committed: Thu Apr 21 10:43:21 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                         |  2 ++
 .../src/java/org/apache/solr/cloud/SyncStrategy.java     | 11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2f68e13/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index fca0311..930f02b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -89,6 +89,8 @@ Bug Fixes
 * SOLR-8633: DistributedUpdateProcess processCommit/deleteByQuery call finish on DUP and
   SolrCmdDistributor, 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)
+
 ======================= 5.5.0 =======================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d2f68e13/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
index d811f5c..22b2ff3 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");
@@ -178,7 +178,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
@@ -196,7 +197,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);
@@ -247,7 +248,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;
@@ -257,7 +258,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);