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:31:15 UTC

[lucene-solr] branch branch_8x 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 branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


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

commit db90ff541ec729dd04d2f293ae54467f2f3dc975
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     | 23 +++++++++++-----------
 .../apache/solr/common/cloud/ZkStateReader.java    |  4 ++--
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index daab4f0..2319f0f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -48,6 +48,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 69c6a6a..1bf0ecc 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) :
@@ -75,7 +75,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) {
@@ -95,9 +96,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));
       }
@@ -109,7 +110,7 @@ public class PerReplicaStatesOps {
   }
 
   /**
-   * state of a replica is changed
+   * Change the state of a replica
    *
    * @param newState the new state
    */
@@ -166,15 +167,15 @@ 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
@@ -217,7 +218,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 -> {
@@ -240,7 +241,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 d9e831e..54d8f6f 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
@@ -1620,7 +1620,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) {
           throw new SolrException(ErrorCode.SERVER_ERROR, "Error fetching per-replica-states");
@@ -1764,7 +1764,7 @@ public class ZkStateReader implements SolrCloseable {
         v = new CollectionWatch<>();
         watchSet.set(true);
       }
-      log.info("already watching , added to stateWatchers");
+      log.debug("already watching , added to stateWatchers");
       v.stateWatchers.add(stateWatcher);
       return v;
     });