You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2021/02/12 06:22:53 UTC

[lucene-solr] branch master updated: SOLR-15136: Reduce excessive logging introduced with Per Replica States feature

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

ishan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 938039a  SOLR-15136: Reduce excessive logging introduced with Per Replica States feature
938039a is described below

commit 938039a6889f3b9125d123cbe11e389d6cf714ba
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Fri Feb 12 11:52:19 2021 +0530

    SOLR-15136: Reduce excessive logging introduced with Per Replica States feature
---
 solr/CHANGES.txt                                   |  2 ++
 .../solr/common/cloud/PerReplicaStatesOps.java     | 25 +++++++++++-----------
 .../apache/solr/common/cloud/ZkStateReader.java    |  2 +-
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2d96b84..1d27948 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -253,6 +253,8 @@ Bug Fixes
 * SOLR-15114: Fix bug that caused WAND optimization to be disabled in cases where the max score is requested (such as
   multi-shard requests in SolrCloud) (Naoto Minami via Tomás Fernández Löbbe)
 
+* SOLR-15136: Reduce excessive logging introduced with Per Replica States feature (Ishan Chattopadhyaya)
+
 ==================  8.8.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
index a0d9a66..3f2f569 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
@@ -60,7 +60,7 @@ public class PerReplicaStatesOps {
 
         List<Op> ops = new ArrayList<>(operations.size());
         for (PerReplicaStates.Operation op : operations) {
-            //the state of the replica is being updated
+            // the state of the replica is being updated
             String path = znode + "/" + op.state.asString;
             ops.add(op.typ == PerReplicaStates.Operation.Type.ADD ?
                     Op.create(path, null, zkClient.getZkACLProvider().getACLsToAdd(path), CreateMode.PERSISTENT) :
@@ -77,7 +77,8 @@ public class PerReplicaStatesOps {
 
     }
 
-    /**There is a possibility that a replica may have some leftover entries . delete them too
+    /**
+     * There is a possibility that a replica may have some leftover entries. Delete them too.
      */
     private static List<PerReplicaStates.Operation> addDeleteStaleNodes(List<PerReplicaStates.Operation> ops, PerReplicaStates.State rs) {
         while (rs != null) {
@@ -97,9 +98,9 @@ public class PerReplicaStatesOps {
                 persist(operations, znode, zkClient);
                 return;
             } catch (KeeperException.NodeExistsException | KeeperException.NoNodeException e) {
-                //state is stale
+                // state is stale
                 if(log.isInfoEnabled()) {
-                    log.info("stale state for {} , attempt: {}. retrying...", znode, i);
+                    log.info("Stale state for {}, attempt: {}. retrying...", znode, i);
                 }
                 operations = refresh(PerReplicaStates.fetch(znode, zkClient, null));
             }
@@ -111,7 +112,7 @@ public class PerReplicaStatesOps {
     }
 
     /**
-     * state of a replica is changed
+     * Change the state of a replica
      *
      * @param newState the new state
      */
@@ -168,21 +169,21 @@ public class PerReplicaStatesOps {
                         ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(st.replica, Replica.State.ACTIVE, Boolean.TRUE, st.version + 1)));
                         ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.DELETE, st));
                     }
-                    //else do not do anything , that node is the leader
+                    // else do not do anything, that node is the leader
                 } else {
-                    //there is no entry for the new leader.
-                    //create one
+                    // there is no entry for the new leader.
+                    // create one
                     ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(next, Replica.State.ACTIVE, Boolean.TRUE, 0)));
                 }
             }
 
-            //now go through all other replicas and unset previous leader
+            // now go through all other replicas and unset previous leader
             for (String r : allReplicas) {
                 PerReplicaStates.State st = rs.get(r);
                 if (st == null) continue;//unlikely
                 if (!Objects.equals(r, next)) {
                     if (st.isLeader) {
-                        //some other replica is the leader now. unset
+                        // some other replica is the leader now. unset
                         ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.ADD, new PerReplicaStates.State(st.replica, st.state, Boolean.FALSE, st.version + 1)));
                         ops.add(new PerReplicaStates.Operation(PerReplicaStates.Operation.Type.DELETE, st));
                     }
@@ -219,7 +220,7 @@ public class PerReplicaStatesOps {
     }
 
     /**
-     * mark a bunch of replicas as DOWN
+     * Mark the given replicas as DOWN
      */
     public static PerReplicaStatesOps downReplicas(List<String> replicas, PerReplicaStates rs) {
         return new PerReplicaStatesOps(prs -> {
@@ -242,7 +243,7 @@ public class PerReplicaStatesOps {
     }
 
     /**
-     * Just creates and deletes a dummy entry so that the {@link Stat#getCversion()} of states.json
+     * Just creates and deletes a dummy entry so that the {@link Stat#getCversion()} of state.json
      * is updated
      */
     public static PerReplicaStatesOps touchChildren() {
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 8aad139..ccd93c6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -1463,7 +1463,7 @@ public class ZkStateReader implements SolrCloseable {
       ClusterState.initReplicaStateProvider(() -> {
         try {
           PerReplicaStates replicaStates = PerReplicaStates.fetch(collectionPath, zkClient, null);
-          log.info("per-replica-state ver: {} fetched for initializing {} ", replicaStates.cversion, collectionPath);
+          log.debug("per-replica-state ver: {} fetched for initializing {} ", replicaStates.cversion, collectionPath);
           return replicaStates;
         } catch (Exception e) {
           //TODO