You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2020/09/01 04:09:16 UTC

[lucene-solr] branch jira/SOLR-14776 created (now 71de2cd)

This is an automated email from the ASF dual-hosted git repository.

datcm pushed a change to branch jira/SOLR-14776
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


      at 71de2cd  SOLR-14776: Precompute the fingerprint during PeerSync

This branch includes the following new commits:

     new 71de2cd  SOLR-14776: Precompute the fingerprint during PeerSync

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-solr] 01/01: SOLR-14776: Precompute the fingerprint during PeerSync

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

datcm pushed a commit to branch jira/SOLR-14776
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 71de2cd4a265ffce211e40ea17daefc8b456973c
Author: Cao Manh Dat <da...@apache.org>
AuthorDate: Tue Sep 1 11:08:52 2020 +0700

    SOLR-14776: Precompute the fingerprint during PeerSync
---
 .../src/java/org/apache/solr/update/PeerSync.java  | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/update/PeerSync.java b/solr/core/src/java/org/apache/solr/update/PeerSync.java
index c23bfb1..6cec3dc 100644
--- a/solr/core/src/java/org/apache/solr/update/PeerSync.java
+++ b/solr/core/src/java/org/apache/solr/update/PeerSync.java
@@ -267,7 +267,14 @@ public class PeerSync implements SolrMetricProducer {
     for (String replica : replicas) {
       requestFingerprint(replica);
     }
-    
+    IndexFingerprint ourFingerprint;
+    try {
+      ourFingerprint = IndexFingerprint.getFingerprint(core, Long.MAX_VALUE);
+    } catch (IOException e) {
+      log.warn("Could not confirm if we are already in sync. Continue with PeerSync");
+      return false;
+    }
+
     for (;;) {
       ShardResponse srsp = shardHandler.takeCompletedOrError();
       if (srsp == null) break;
@@ -281,19 +288,14 @@ public class PeerSync implements SolrMetricProducer {
         log.warn("Replica did not return a fingerprint - possibly an older Solr version or exception");
         continue;
       }
-      
-      try {
-        IndexFingerprint otherFingerprint = IndexFingerprint.fromObject(replicaFingerprint);
-        IndexFingerprint ourFingerprint = IndexFingerprint.getFingerprint(core, Long.MAX_VALUE);
-        if(IndexFingerprint.compare(otherFingerprint, ourFingerprint) == 0) {
-          log.info("We are already in sync. No need to do a PeerSync ");
-          return true;
-        }
-      } catch(IOException e) {
-        log.warn("Could not confirm if we are already in sync. Continue with PeerSync");
+
+      IndexFingerprint otherFingerprint = IndexFingerprint.fromObject(replicaFingerprint);
+      if(IndexFingerprint.compare(otherFingerprint, ourFingerprint) == 0) {
+        log.info("We are already in sync. No need to do a PeerSync ");
+        return true;
       }
     }
-    
+
     return false;
   }