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

Logs deletion fixes #4625

Merged
merged 8 commits into from
Nov 3, 2021

Conversation

sandeepsukhani
Copy link
Contributor

@sandeepsukhani sandeepsukhani commented Nov 3, 2021

What this PR does / why we need it:
It includes the following two changes:

  1. We check for whether the table would have chunks requested for deletion based on the delete request interval and the interval for which the table is expected to hold data or get queries, calculated using the table number. The problem here though is a chunk could overlap multiple tables so if a delete request is deleting the chunk for just one of the days, the index entry would stay untouched for the days for which the chunk has not been requested for deletion. To avoid this problem I am making compactor to go through all the index tables since it is hard to know how many tables a chunk could overlap. I had noticed chunks overlapping as long as 7 tables so it is safe to not skip any tables for now, until I can find a way to make this optimization work for delete requests too.

  2. We upload the modified index from a table only when a chunk indexed in it has been marked for deletion. With some conditions, we sometimes just drop the index entry without marking chunk for deletion. This PR adds a check for it and uploads the index when it is modified even without marking any chunks for deletion.

Checklist

  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner November 3, 2021 11:43
@sandeepsukhani sandeepsukhani changed the title Logs deletion check all tables Logs deletion fixes Nov 3, 2021
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 3, 2021
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM.

I'd love to have a comment to explain why just with the request it's not enough to figure if a table should be inspected or not.

@sandeepsukhani
Copy link
Contributor Author

Thanks for the review folks! I have taken care of the suggestions.

t.markerMetrics.tableProcessedTotal.WithLabelValues(tableName, tableActionNone).Inc()
return empty, markerWriter.Count(), nil
return empty, modified, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

tiny nit: but I think it makes it slightly easier to read to hard-code this value to false, as it doesn't require the reader to invert the condition (which is already an inversion) that got them here,

}
t.markerMetrics.tableProcessedTotal.WithLabelValues(tableName, tableActionModified).Inc()
return empty, markerWriter.Count(), nil
return empty, modified, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here with hard-coding to true

@owen-d owen-d merged commit 2564a81 into grafana:main Nov 3, 2021
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.

None yet

4 participants