Skip to content

Conversation

@shivaom02
Copy link
Contributor

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.

@adoroszlai
Copy link
Contributor

Thanks @shivaom02 for the patch. Please enable the build-branch workflow in your fork.

@shivaom02
Copy link
Contributor Author

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()) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thank you.

Copy link
Contributor

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.

public String getTxIDSummary() {
List<String> txSummaryEntry = txSummary.entrySet().stream()
.map(entry -> entry.getKey() + "(" + entry.getValue() + ")")
.collect(Collectors.toList());
return "[" + String.join(",", txSummaryEntry) + "]";
}

@adoroszlai
Copy link
Contributor

enabled all workflows from my fork

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.

Copy link
Contributor

@sodonnel sodonnel left a 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.

@sodonnel sodonnel changed the title HDDS-9462: DeleteBlocksCommandHandler should not print TXID at info level HDDS-9462. DeleteBlocksCommandHandler should not print TXID at info level Oct 25, 2023
@shivaom02
Copy link
Contributor Author

enabled all workflows from my fork

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.

Okay, Thanks @adoroszlai

@shivaom02
Copy link
Contributor Author

LGTM pending green CI.

Thanks for the review @sodonnel. The CI checks have passed.

Copy link
Contributor

@adoroszlai adoroszlai left a 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.

@shivaom02
Copy link
Contributor Author

I've made the changes, please approve the workflows @adoroszlai

@shivaom02 shivaom02 requested a review from adoroszlai October 26, 2023 06:35
@shivaom02
Copy link
Contributor Author

@adoroszlai, I had an indentation error, I've fixed it. Please approve the workflow.

@sodonnel
Copy link
Contributor

Ah of course. I missed the expense of creating the passed parameter to the debug message.

@adoroszlai adoroszlai merged commit 6bf3886 into apache:master Oct 26, 2023
@adoroszlai
Copy link
Contributor

Thanks @shivaom02 for the patch, @sodonnel for the review.

@shivaom02
Copy link
Contributor Author

Thank you so much @adoroszlai .

@shivaom02 shivaom02 deleted the HDDS-9462 branch October 27, 2023 01:03
ibrusentsev pushed a commit to ibrusentsev/ozone that referenced this pull request Nov 14, 2023
ptlrs pushed a commit to ptlrs/ozone that referenced this pull request Mar 8, 2025
…ID at info level (apache#5481) (apache#183)

(cherry picked from commit 6bf3886)

Co-authored-by: Shivam Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants