You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ha...@apache.org on 2019/06/10 20:11:06 UTC
[zookeeper] branch master updated: ZKUtil deleteRecursive check LOG
Level before calculate the parameter
This is an automated email from the ASF dual-hosted git repository.
hanm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new a5487e4 ZKUtil deleteRecursive check LOG Level before calculate the parameter
a5487e4 is described below
commit a5487e40b3065eea6c3beecb568d13e22fc2e494
Author: geker <nk...@gmail.com>
AuthorDate: Mon Jun 10 13:10:50 2019 -0700
ZKUtil deleteRecursive check LOG Level before calculate the parameter
LOG.debug("Deleting " + tree); will be calculate tree.toString() even if the log level is higher
than debug.
this pull request check debugEnabled before logging,avoid deleteRecursive large tree which may cause OOM.
Author: geker <nk...@gmail.com>
Reviewers: Enrico Olivelli <eo...@gmail.com>, Michael Han <ha...@apache.org>
Closes #968 from Geker/master
---
zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
index 9666bf1..8f758c9 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
@@ -53,8 +53,8 @@ public class ZKUtil {
PathUtils.validatePath(pathRoot);
List<String> tree = listSubTreeBFS(zk, pathRoot);
- LOG.debug("Deleting " + tree);
- LOG.debug("Deleting " + tree.size() + " subnodes ");
+ LOG.debug("Deleting {}",tree);
+ LOG.debug("Deleting {} subnodes ",tree.size());
return deleteInBatch(zk, tree, batchSize);
}
@@ -125,8 +125,8 @@ public class ZKUtil {
PathUtils.validatePath(pathRoot);
List<String> tree = listSubTreeBFS(zk, pathRoot);
- LOG.debug("Deleting " + tree);
- LOG.debug("Deleting " + tree.size() + " subnodes ");
+ LOG.debug("Deleting {}",tree);
+ LOG.debug("Deleting {} subnodes ",tree.size());
for (int i = tree.size() - 1; i >= 0 ; --i) {
//Delete the leaves first and eventually get rid of the root
zk.delete(tree.get(i), -1, cb, ctx); //Delete all versions of the node with -1.