Browse Source

ZOOKEEPER-1390. some expensive debug code not protected by a check for debug (breed via camille)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1301947 13f79535-47bb-0310-9956-ffa450edef68
Camille Fournier 13 years ago
parent
commit
53cbcc6086
2 changed files with 9 additions and 16 deletions
  1. 3 1
      CHANGES.txt
  2. 6 15
      src/java/main/org/apache/zookeeper/server/DataTree.java

+ 3 - 1
CHANGES.txt

@@ -151,7 +151,9 @@ BUGFIXES:
 
 
   ZOOKEEPER-1307. zkCli.sh is exiting when an Invalid ACL exception is
   ZOOKEEPER-1307. zkCli.sh is exiting when an Invalid ACL exception is
   thrown from setACL command through client (Kavita Sharma via phunt)
   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:
 IMPROVEMENTS:
 
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

+ 6 - 15
src/java/main/org/apache/zookeeper/server/DataTree.java

@@ -724,7 +724,6 @@ public class DataTree {
     {
     {
         ProcessTxnResult rc = new ProcessTxnResult();
         ProcessTxnResult rc = new ProcessTxnResult();
 
 
-        String debug = "";
         try {
         try {
             rc.clientId = header.getClientId();
             rc.clientId = header.getClientId();
             rc.cxid = header.getCxid();
             rc.cxid = header.getCxid();
@@ -735,7 +734,6 @@ public class DataTree {
             switch (header.getType()) {
             switch (header.getType()) {
                 case OpCode.create:
                 case OpCode.create:
                     CreateTxn createTxn = (CreateTxn) txn;
                     CreateTxn createTxn = (CreateTxn) txn;
-                    debug = "Create transaction for " + createTxn.getPath();
                     rc.path = createTxn.getPath();
                     rc.path = createTxn.getPath();
                     createNode(
                     createNode(
                             createTxn.getPath(),
                             createTxn.getPath(),
@@ -747,15 +745,11 @@ public class DataTree {
                     break;
                     break;
                 case OpCode.delete:
                 case OpCode.delete:
                     DeleteTxn deleteTxn = (DeleteTxn) txn;
                     DeleteTxn deleteTxn = (DeleteTxn) txn;
-                    debug = "Delete transaction for " + deleteTxn.getPath();
                     rc.path = deleteTxn.getPath();
                     rc.path = deleteTxn.getPath();
                     deleteNode(deleteTxn.getPath(), header.getZxid());
                     deleteNode(deleteTxn.getPath(), header.getZxid());
                     break;
                     break;
                 case OpCode.setData:
                 case OpCode.setData:
                     SetDataTxn setDataTxn = (SetDataTxn) txn;
                     SetDataTxn setDataTxn = (SetDataTxn) txn;
-                    debug = "Set data transaction for "
-                            + setDataTxn.getPath()
-                            + " to new value=" + Arrays.toString(setDataTxn.getData());
                     rc.path = setDataTxn.getPath();
                     rc.path = setDataTxn.getPath();
                     rc.stat = setData(setDataTxn.getPath(), setDataTxn
                     rc.stat = setData(setDataTxn.getPath(), setDataTxn
                             .getData(), setDataTxn.getVersion(), header
                             .getData(), setDataTxn.getVersion(), header
@@ -763,8 +757,6 @@ public class DataTree {
                     break;
                     break;
                 case OpCode.setACL:
                 case OpCode.setACL:
                     SetACLTxn setACLTxn = (SetACLTxn) txn;
                     SetACLTxn setACLTxn = (SetACLTxn) txn;
-                    debug = "Set ACL transaction for "
-                            + setACLTxn.getPath();
                     rc.path = setACLTxn.getPath();
                     rc.path = setACLTxn.getPath();
                     rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                     rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                             setACLTxn.getVersion());
                             setACLTxn.getVersion());
@@ -778,16 +770,11 @@ public class DataTree {
                     break;
                     break;
                 case OpCode.check:
                 case OpCode.check:
                     CheckVersionTxn checkTxn = (CheckVersionTxn) txn;
                     CheckVersionTxn checkTxn = (CheckVersionTxn) txn;
-                    debug = "Check Version transaction for "
-                            + checkTxn.getPath()
-                            + " and version="
-                            + checkTxn.getVersion();
                     rc.path = checkTxn.getPath();
                     rc.path = checkTxn.getPath();
                     break;
                     break;
                 case OpCode.multi:
                 case OpCode.multi:
                     MultiTxn multiTxn = (MultiTxn) txn ;
                     MultiTxn multiTxn = (MultiTxn) txn ;
                     List<Txn> txns = multiTxn.getTxns();
                     List<Txn> txns = multiTxn.getTxns();
-                    debug = "Multi transaction with " + txns.size() + " operations";
                     rc.multiResult = new ArrayList<ProcessTxnResult>();
                     rc.multiResult = new ArrayList<ProcessTxnResult>();
                     boolean failed = false;
                     boolean failed = false;
                     for (Txn subtxn : txns) {
                     for (Txn subtxn : txns) {
@@ -849,10 +836,14 @@ public class DataTree {
                     break;
                     break;
             }
             }
         } catch (KeeperException e) {
         } catch (KeeperException e) {
-            LOG.debug("Failed: " + debug, e);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Failed: " + header + ":" + txn, e);
+            }
             rc.err = e.code().intValue();
             rc.err = e.code().intValue();
         } catch (IOException e) {
         } 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
          * A snapshot might be in progress while we are modifying the data