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

apurtell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new ed56a40  HBASE-25588 Excessive logging of "hbase.zookeeper.useMulti is 
deprecated. Default to true always." (#3640)
ed56a40 is described below

commit ed56a40e46f493aed426f13152270c73a281b11d
Author: Andrew Purtell <[email protected]>
AuthorDate: Tue Aug 31 09:39:21 2021 -0700

    HBASE-25588 Excessive logging of "hbase.zookeeper.useMulti is deprecated. 
Default to true always." (#3640)
    
    Signed-off-by: Viraj Jasani <[email protected]>
    Reviewed-by: Duo Zhang <[email protected]>
---
 .../java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java 
b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
index d124a9a..e3337f5 100644
--- 
a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
+++ 
b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
@@ -1760,6 +1760,12 @@ public final class ZKUtil {
     }
   }
 
+  // Static boolean for warning about useMulti because ideally there will be 
one warning per
+  // process instance. It is fine if two threads end up racing on this for a 
bit. We do not
+  // need to use an atomic type for this, that is overkill. The goal of 
reducing the number of
+  // warnings from many to one or a few at startup is still achieved.
+  private static boolean useMultiWarn = true;
+
   /**
    * Use ZooKeeper's multi-update functionality.
    *
@@ -1780,14 +1786,16 @@ public final class ZKUtil {
    * @throws KeeperException if a ZooKeeper operation fails
    */
   public static void multiOrSequential(ZKWatcher zkw, List<ZKUtilOp> ops,
-                                       boolean runSequentialOnMultiFailure) 
throws KeeperException {
-    if (zkw.getConfiguration().get("hbase.zookeeper.useMulti") != null) {
-      LOG.warn("hbase.zookeeper.useMulti is deprecated. Default to true 
always.");
-    }
+      boolean runSequentialOnMultiFailure) throws KeeperException {
     if (ops == null) {
       return;
     }
-
+    if (useMultiWarn) { // Only check and warn at first use
+      if (zkw.getConfiguration().get("hbase.zookeeper.useMulti") != null) {
+        LOG.warn("hbase.zookeeper.useMulti is deprecated. Default to true 
always.");
+      }
+      useMultiWarn = false;
+    }
     List<Op> zkOps = new LinkedList<>();
     for (ZKUtilOp op : ops) {
       zkOps.add(toZooKeeperOp(zkw, op));

Reply via email to