-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-9462. DeleteBlocksCommandHandler should not print TXID at info level #5481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks @shivaom02 for the patch. Please enable the |
|
Thanks @adoroszlai , I've enabled all workflows from my fork. |
| DeletedContainerBlocksSummary summary = | ||
| DeletedContainerBlocksSummary.getFrom(containerBlocks); | ||
| LOG.info("Start to delete container blocks, TXIDs={}, " | ||
| if (LOG.isDebugEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the if (LOG.isDebugEnabled()) and just change the log message to debug level, ie:
LOG.debug("Start to delete container blocks, TXIDs={}",
summary.getTxIDSummary());
Inside the logger, it applies the if (LOG.isDebugEnabled()) so if we just use a debug level log, then we can remove the extra if statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we're better off using if (LOG.isDebugEnabled()) in this case. getTxIDSummary() performs quite a bit of stream/string processing, which we would like to avoid if the log is going to be discarded.
Lines 93 to 98 in 47f472f
| public String getTxIDSummary() { | |
| List<String> txSummaryEntry = txSummary.entrySet().stream() | |
| .map(entry -> entry.getKey() + "(" + entry.getValue() + ")") | |
| .collect(Collectors.toList()); | |
| return "[" + String.join(",", txSummaryEntry) + "]"; | |
| } |
Great. Note: if you push multiple commits for the same branch in your fork, you might want to cancel runs for obsolete commits you no longer care about. |
sodonnel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending green CI.
Okay, Thanks @adoroszlai |
Thanks for the review @sodonnel. The CI checks have passed. |
adoroszlai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shivaom02 for updating the patch.
In addition to restoring isDebugEnabled(), I would also consider moving the detailed debug message after the info-level summary one.
...he/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
Outdated
Show resolved
Hide resolved
|
I've made the changes, please approve the workflows @adoroszlai |
|
@adoroszlai, I had an indentation error, I've fixed it. Please approve the workflow. |
|
Ah of course. I missed the expense of creating the passed parameter to the debug message. |
|
Thanks @shivaom02 for the patch, @sodonnel for the review. |
|
Thank you so much @adoroszlai . |
…ID at info level (apache#5481) (apache#183) (cherry picked from commit 6bf3886) Co-authored-by: Shivam Kumar <[email protected]>
What changes were proposed in this pull request?
DeleteBlocksCommandHandler should not print TXID at info level.
Basically, the DeleteBlocksCommandHandler was logging all the delete block transaction IDs at info level, and thus flooding the datanode log.
Now, the transaction IDs are logged only if the Debug node is enabled, otherwise only the number of transactions are logged at info level.
This is done so that user is not overwhelmed with unimportant information, rather have cleaner and more relevant information.
What is the link to the Apache JIRA
HDDS-9462
How was this patch tested?
As it is only a logging change, no new test cases were added. But the existing tests for this module were run successfully.