-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-14418. Skip sending block deletion command to SCM for empty files. #9635
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
base: master
Are you sure you want to change the base?
Conversation
|
@priyeshkaratha , can you add a unit test for this case? Manual test is good, but unit test is more preferred if not too difficult to create a new unit test. |
| keyBlocksList.size(), logSize, keyBlocksList.entrySet().stream().limit(logSize) | ||
| LOG.info("Send {} key(s) to SCM (filtered {} empty files), first {} keys: {}", | ||
| nonEmptyKeyBlocksList.size(), keyBlocksList.size() - nonEmptyKeyBlocksList.size(), logSize, | ||
| nonEmptyKeyBlocksList.entrySet().stream().limit(logSize) |
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.
These empty files can happen mostly in testing, No need to update normal logs to avoid confusion. Instead please add separate debug log if any empty files/blocks are present.
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.
+1. Lets keep them logged as DEBUG. Also probably use 'keys' instead of 'files' to maintain uniformity while logging
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 for reviewing the changes. Addressed the changes mentioned.
| logSize = nonEmptyKeyBlocksList.size(); | ||
| } | ||
| LOG.info("Send {} key(s) to SCM, first {} keys: {}", | ||
| keyBlocksList.size(), logSize, keyBlocksList.entrySet().stream().limit(logSize) |
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.
Shall we include both nonEmptyKeyBlocksList and keyBlocksList info here too?
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 @ChenSammi for the catch we can skip empty size keys here. I have updated the patch.
| } | ||
|
|
||
| // Add successful results for empty files (no need to send to SCM) | ||
| Map<String, PurgedKey> emptyKeyBlocksList = keyBlocksList.entrySet().stream() |
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.
Please add a nonEmptyKeyBlocksList and keyBlocksList size check before going into emptyKeyBlocksList construction and DeleteBlockGroupResult construction.
| * The KeyDeletingService should filter out empty keys before calling SCM. | ||
| */ | ||
| @Test | ||
| void checkIfDeleteServiceIsDeletingZeroSizedKeys() |
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.
Please add one more test for mixed file size case.
sadanand48
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 overall, Thanks @priyeshkaratha for the patch
What changes were proposed in this pull request?
When OM sends block deletion requests to SCM we can skip it if deleted blocklists are empty for the blockgroup. It indicates its delete request for empty file. So that we can also make sure fast deletion for keys that created with empty sizes.
What is the link to the Apache JIRA
HDDS-14418
How was this patch tested?
Tested locally using creating 1 empty file and 1 normal file and deleted both files. 1 file git skipped as per requirement.
CI is green