-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add force delete operation on server #2815
Add force delete operation on server #2815
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2815 +/- ##
============================================
+ Coverage 64.24% 70.20% +5.95%
- Complexity 10398 11755 +1357
============================================
Files 840 842 +2
Lines 71755 72380 +625
Branches 8611 8712 +101
============================================
+ Hits 46099 50814 +4715
+ Misses 23004 18906 -4098
- Partials 2652 2660 +8 ☔ View full report in Codecov by Sentry. |
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.
most parts LGTM. could you also add some comments.
if (e.getErrorCode() == StoreErrorCodes.ID_Not_Found && deleteRequest.shouldForceDelete()) { | ||
try { | ||
// If frontend forces a delete operation, place a tombstone even though blob is not present | ||
Objects.requireNonNull(storeToDelete).forceDelete(Collections.singletonList(info)); |
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.
if we are here, the storeToDelete
will not be null.
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.
Yeah.. true.
if (e.getErrorCode() == StoreErrorCodes.ID_Not_Found && deleteRequest.shouldForceDelete()) { | ||
try { | ||
// If frontend forces a delete operation, place a tombstone even though blob is not present | ||
Objects.requireNonNull(storeToDelete).forceDelete(Collections.singletonList(info)); |
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.
one thing about the forceDelete
is the the MessageInfo
passed to this method can't have -1 lifeVersion. It has to be something meaningful. We have to change the MessageInfo to have 0 as lifeVersion.
Can you also add a comment to forceDelete method?
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. Added comments to the forceDelete method that the lifeVersion of input should be a valid value.
metrics.idDeletedError.inc(); | ||
} else if (e.getErrorCode() == StoreErrorCodes.Authorization_Failure) { | ||
metrics.deleteAuthorizationFailure.inc(); | ||
if (e.getErrorCode() == StoreErrorCodes.ID_Not_Found && deleteRequest.shouldForceDelete()) { |
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 create a new method for this logic, something like maybeForceDelete
.
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. Created a new method for this logic.
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, please add some test cases for the new code.
Changes to place a delete tombstone on server even if blob is not present