Skip to content
Browse files

ZOOKEEPER-1390. some expensive debug code not protected by a check fo…

…r debug (breed via camille)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1301947 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 745dece commit 42c49de1c8f414f756daf70aea091ab412f7c8d2 @skamille skamille committed Mar 17, 2012
Showing with 9 additions and 16 deletions.
  1. +3 −1 CHANGES.txt
  2. +6 −15 src/java/main/org/apache/zookeeper/server/DataTree.java
View
4 CHANGES.txt
@@ -151,7 +151,9 @@ BUGFIXES:
ZOOKEEPER-1307. zkCli.sh is exiting when an Invalid ACL exception is
thrown from setACL command through client (Kavita Sharma via phunt)
-
+
+ ZOOKEEPER-1390. some expensive debug code not protected by a check for debug (breed via camille)
+
IMPROVEMENTS:
ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,
View
21 src/java/main/org/apache/zookeeper/server/DataTree.java
@@ -724,7 +724,6 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
{
ProcessTxnResult rc = new ProcessTxnResult();
- String debug = "";
try {
rc.clientId = header.getClientId();
rc.cxid = header.getCxid();
@@ -735,7 +734,6 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
switch (header.getType()) {
case OpCode.create:
CreateTxn createTxn = (CreateTxn) txn;
- debug = "Create transaction for " + createTxn.getPath();
rc.path = createTxn.getPath();
createNode(
createTxn.getPath(),
@@ -747,24 +745,18 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
break;
case OpCode.delete:
DeleteTxn deleteTxn = (DeleteTxn) txn;
- debug = "Delete transaction for " + deleteTxn.getPath();
rc.path = deleteTxn.getPath();
deleteNode(deleteTxn.getPath(), header.getZxid());
break;
case OpCode.setData:
SetDataTxn setDataTxn = (SetDataTxn) txn;
- debug = "Set data transaction for "
- + setDataTxn.getPath()
- + " to new value=" + Arrays.toString(setDataTxn.getData());
rc.path = setDataTxn.getPath();
rc.stat = setData(setDataTxn.getPath(), setDataTxn
.getData(), setDataTxn.getVersion(), header
.getZxid(), header.getTime());
break;
case OpCode.setACL:
SetACLTxn setACLTxn = (SetACLTxn) txn;
- debug = "Set ACL transaction for "
- + setACLTxn.getPath();
rc.path = setACLTxn.getPath();
rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
setACLTxn.getVersion());
@@ -778,16 +770,11 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
break;
case OpCode.check:
CheckVersionTxn checkTxn = (CheckVersionTxn) txn;
- debug = "Check Version transaction for "
- + checkTxn.getPath()
- + " and version="
- + checkTxn.getVersion();
rc.path = checkTxn.getPath();
break;
case OpCode.multi:
MultiTxn multiTxn = (MultiTxn) txn ;
List<Txn> txns = multiTxn.getTxns();
- debug = "Multi transaction with " + txns.size() + " operations";
rc.multiResult = new ArrayList<ProcessTxnResult>();
boolean failed = false;
for (Txn subtxn : txns) {
@@ -849,10 +836,14 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
break;
}
} catch (KeeperException e) {
- LOG.debug("Failed: " + debug, e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Failed: " + header + ":" + txn, e);
+ }
rc.err = e.code().intValue();
} catch (IOException e) {
- LOG.debug("Failed:" + debug, e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Failed: " + header + ":" + txn, e);
+ }
}
/*
* A snapshot might be in progress while we are modifying the data

0 comments on commit 42c49de

Please sign in to comment.
Something went wrong with that request. Please try again.