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>
This commit is contained in:
Andrew Purtell 2021-08-31 09:39:21 -07:00 committed by GitHub
parent d19728b80c
commit ed56a40e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -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));