-
Notifications
You must be signed in to change notification settings - Fork 475
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
HDDS-3930. Fix OMKeyDeletesRequest. #1169
Conversation
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 @bharatviswa504 for the PR. I have some comments.
.../ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeysDeleteRequest.java
Outdated
Show resolved
Hide resolved
.../ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeysDeleteRequest.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1169 +/- ##
============================================
+ Coverage 73.50% 73.59% +0.08%
- Complexity 10037 10137 +100
============================================
Files 974 974
Lines 49685 50086 +401
Branches 4883 4979 +96
============================================
+ Hits 36523 36862 +339
- Misses 10845 10889 +44
- Partials 2317 2335 +18 Continue to review full report at Codecov.
|
.../ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeysDeleteRequest.java
Show resolved
Hide resolved
.../ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeysDeleteRequest.java
Outdated
Show resolved
Hide resolved
...zone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeysDeleteResponse.java
Show resolved
Hide resolved
62eded8
to
ec8068c
Compare
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 @bharatviswa504 for updating the patch. Audit now looks good. There are a few places where I think more change is needed.
} | ||
} | ||
public void deleteKeys(OmDeleteKeys deleteKeys) throws IOException { | ||
throw new NotImplementedException("OzoneManager does not require this to " + |
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 consider changing to UnsupportedOperationException
as
NotImplementedException
represents the case where the author has yet to implement the logic at this point in the program
for (int i = indexFailed; i < length; i++) { | ||
unDeletedKeys.addKeys(deleteKeyArgs.getKeys(indexFailed)); |
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.
Should not repeatedly add the same key:
for (int i = indexFailed; i < length; i++) { | |
unDeletedKeys.addKeys(deleteKeyArgs.getKeys(indexFailed)); | |
for (int i = indexFailed; i < length; i++) { | |
unDeletedKeys.addKeys(deleteKeyArgs.getKeys(i)); |
|
||
auditLog(auditLogger, buildAuditMessage( | ||
OMAction.DELETE_KEYS, auditMap, exception, userInfo)); | ||
|
||
|
||
switch (result) { | ||
case SUCCESS: | ||
omMetrics.decNumKeys(); |
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.
Should decrease number of keys by deleteKeys.size()
.
LOG.debug("Key deleted. Volume:{}, Bucket:{}, Key:{}", volumeName, | ||
bucketName, keyName); |
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.
Might want to log all keys:
LOG.debug("Key deleted. Volume:{}, Bucket:{}, Key:{}", volumeName, | |
bucketName, keyName); | |
LOG.debug("Key deleted. Volume:{}, Bucket:{}, Key:{}", volumeName, | |
bucketName, deleteKeys); |
|
||
auditLog(auditLogger, buildAuditMessage( | ||
OMAction.DELETE_KEYS, auditMap, exception, userInfo)); | ||
|
||
|
||
switch (result) { | ||
case SUCCESS: | ||
omMetrics.decNumKeys(); | ||
LOG.debug("Key deleted. Volume:{}, Bucket:{}, Key:{}", volumeName, | ||
bucketName, keyName); |
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.
In the success case, the omMetrics.decNumKeys() only -1, which does not reflect the deleted keys if there are more than one key in the request.
NIT: in success case, we only put the keyName of the last successful delete. If we want to put the names of all deleted keys. We should guard it with if (LOG.isDebugEnabled())
case FAILURE: | ||
omMetrics.incNumKeyDeleteFails(); | ||
LOG.error("Key delete failed. Volume:{}, Bucket:{}, Key{}." + | ||
" Exception:{}", volumeName, bucketName, keyName, exception); | ||
LOG.error("Key delete failed. Volume:{}, Bucket:{}, Key:{}", |
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.
Should we reword the error message to differentiate with the single delete.
LOG.error("Key delete failed. Volume:{}, Bucket:{}, Key{}." + | ||
" Exception:{}", volumeName, bucketName, keyName, exception); | ||
LOG.error("Key delete failed. Volume:{}, Bucket:{}, Key:{}", | ||
volumeName, bucketName, keyName, exception); | ||
break; | ||
default: | ||
LOG.error("Unrecognized Result for OMKeyDeleteRequest: {}", |
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.
OMKeyDeleteRequest=> OMKeysDeleteRequest
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 @bharatviswa504 for the update. Just few minor comments, otherwise LGTM.
Thank You @xiaoyuyao and @adoroszlai for the review. |
SonarCloud Quality Gate failed. 0 Bugs 77.4% Coverage The version of Java (1.8.0_232) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11. |
This is being closed and opened as #1195 |
What changes were proposed in this pull request?
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-3930
How was this patch tested?
Existing tests.