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

feat: dedupe duplicate delete requests while loading them for processing in compactor #15852

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
While loading delete requests for processing, we will look for duplicate delete requests and mark them as processed when we are done processing the loaded requests. This should avoid wasting resources in processing the same requests sent multiple times by the users.

Checklist

  • Tests updated

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner January 21, 2025 09:22
@@ -160,6 +161,29 @@ func (d *DeleteRequest) IsDeleted(entry retention.ChunkEntry) (bool, filter.Func
return true, ff
}

func (d *DeleteRequest) IsDuplicate(o *DeleteRequest) (bool, error) {
if d.RequestID == o.RequestID || d.UserID != o.UserID || d.StartTime != o.StartTime || d.EndTime != o.EndTime {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if d.RequestID == o.RequestID || d.UserID != o.UserID || d.StartTime != o.StartTime || d.EndTime != o.EndTime {
if d.RequestID != o.RequestID || d.UserID != o.UserID || d.StartTime != o.StartTime || d.EndTime != o.EndTime {

Copy link
Collaborator

Choose a reason for hiding this comment

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

i wasn't 100% certain on the request ID being equal or not, but it struck me as unusual having one equality test and 3 non-equality tests in the same block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would never have duplicates from the same request, so the equality check was meant for that. I have separated the equality and inequality checks and added a comment.

@sandeepsukhani sandeepsukhani merged commit 81940c8 into main Jan 22, 2025
59 checks passed
@sandeepsukhani sandeepsukhani deleted the compactor-dedupe-duplicate-delete-requests branch January 22, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants