Skip to content

Commit ed56a40

Browse files
authored
HBASE-25588 Excessive logging of "hbase.zookeeper.useMulti is deprecated. Default to true always." (#3640)
Signed-off-by: Viraj Jasani <vjasani@apache.org> Reviewed-by: Duo Zhang <zhangduo@apache.org>
1 parent d19728b commit ed56a40

File tree

1 file changed

+13
-5
lines changed
  • hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper

1 file changed

+13
-5
lines changed

hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,12 @@ private static Op toZooKeeperOp(ZKWatcher zkw, ZKUtilOp op) throws UnsupportedOp
17601760
}
17611761
}
17621762

1763+
// Static boolean for warning about useMulti because ideally there will be one warning per
1764+
// process instance. It is fine if two threads end up racing on this for a bit. We do not
1765+
// need to use an atomic type for this, that is overkill. The goal of reducing the number of
1766+
// warnings from many to one or a few at startup is still achieved.
1767+
private static boolean useMultiWarn = true;
1768+
17631769
/**
17641770
* Use ZooKeeper's multi-update functionality.
17651771
*
@@ -1780,14 +1786,16 @@ private static Op toZooKeeperOp(ZKWatcher zkw, ZKUtilOp op) throws UnsupportedOp
17801786
* @throws KeeperException if a ZooKeeper operation fails
17811787
*/
17821788
public static void multiOrSequential(ZKWatcher zkw, List<ZKUtilOp> ops,
1783-
boolean runSequentialOnMultiFailure) throws KeeperException {
1784-
if (zkw.getConfiguration().get("hbase.zookeeper.useMulti") != null) {
1785-
LOG.warn("hbase.zookeeper.useMulti is deprecated. Default to true always.");
1786-
}
1789+
boolean runSequentialOnMultiFailure) throws KeeperException {
17871790
if (ops == null) {
17881791
return;
17891792
}
1790-
1793+
if (useMultiWarn) { // Only check and warn at first use
1794+
if (zkw.getConfiguration().get("hbase.zookeeper.useMulti") != null) {
1795+
LOG.warn("hbase.zookeeper.useMulti is deprecated. Default to true always.");
1796+
}
1797+
useMultiWarn = false;
1798+
}
17911799
List<Op> zkOps = new LinkedList<>();
17921800
for (ZKUtilOp op : ops) {
17931801
zkOps.add(toZooKeeperOp(zkw, op));

0 commit comments

Comments
 (0)