Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
skamille committed Mar 17, 2012
1 parent 745dece commit 42c49de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
4 changes: 3 additions & 1 deletion CHANGES.txt
Expand Up @@ -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,
Expand Down
21 changes: 6 additions & 15 deletions src/java/main/org/apache/zookeeper/server/DataTree.java
Expand Up @@ -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();
Expand All @@ -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(),
Expand All @@ -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());
Expand All @@ -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) {
Expand Down Expand Up @@ -849,10 +836,14 @@ record = new ErrorTxn(ec);
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
Expand Down

0 comments on commit 42c49de

Please sign in to comment.