[go: nahoru, domu]

Skip to content
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

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

Arun-LinkedIn
Copy link
Contributor

Changes to place a delete tombstone on server even if blob is not present

@codecov-commenter
Copy link
codecov-commenter commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 68.62745% with 16 lines in your changes missing coverage. Please review.

Project coverage is 70.20%. Comparing base (52ba813) to head (c4a853c).
Report is 42 commits behind head on master.

Files Patch % Lines
...in/java/com/github/ambry/server/AmbryRequests.java 65.21% 12 Missing and 4 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator
@justinlin-linkedin justinlin-linkedin left a 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));
Copy link
Collaborator

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.

Copy link
Contributor Author

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));
Copy link
Collaborator

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?

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

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.

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. Created a new method for this logic.

Copy link
Collaborator
@justinlin-linkedin justinlin-linkedin left a 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.

@Arun-LinkedIn Arun-LinkedIn merged commit 41012cc into linkedin:master Jul 11, 2024
5 checks passed
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.

None yet

3 participants