elek commented on a change in pull request #234: HDDS-2531. Sonar : remove 
duplicate string literals in BlockOutputStream
URL: https://github.com/apache/hadoop-ozone/pull/234#discussion_r353117304
 
 

 ##########
 File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
 ##########
 @@ -391,26 +391,20 @@ private void watchForCommit(boolean bufferFull) throws 
IOException {
               .equals(responseBlockID.getContainerBlockID()));
           // updates the bcsId of the block
           blockID.set(responseBlockID);
-          if (LOG.isDebugEnabled()) {
-            LOG.debug(
-                "Adding index " + asyncReply.getLogIndex() + " commitMap size "
-                    + commitWatcher.getCommitInfoMapSize() + " flushLength "
-                    + flushPos + " numBuffers " + byteBufferList.size()
-                    + " blockID " + blockID + " bufferPool size" + bufferPool
-                    .getSize() + " currentBufferIndex " + bufferPool
-                    .getCurrentBufferIndex());
-          }
+          LOG.debug("Adding index {} commitMap size {} flushLength {} "
+                  + "numBuffers {} blockID {} bufferPool size {} "
+                  + "currentBufferIndex {}", asyncReply.getLogIndex(),
+              commitWatcher.getCommitInfoMapSize(), flushPos,
+              byteBufferList.size(), blockID, bufferPool.getSize(),
+              bufferPool.getCurrentBufferIndex());
           // for standalone protocol, logIndex will always be 0.
           commitWatcher
               .updateCommitInfoMap(asyncReply.getLogIndex(), byteBufferList);
         }
         return e;
       }, responseExecutor).exceptionally(e -> {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug(
-              "putBlock failed for blockID " + blockID + " with exception " + e
-                  .getLocalizedMessage());
-        }
+        LOG.debug("putBlock failed for blockID {} with exception {}",
 
 Review comment:
   This is just the message of the exception not the stack trace itself (as 
before). I think it's reasonable to keep it as it's just a debug log which 
helps to localize the problem, the original exception is kept and part of the 
new exception which is propagated. So the full exception will be printed out 
somewhere from the callers.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to