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

refactor(blooms): Delete outdated metas #13153

Merged
merged 10 commits into from
Jun 7, 2024

Conversation

salvacorts
Copy link
Contributor

@salvacorts salvacorts commented Jun 6, 2024

What this PR does / why we need it:
In This PR we implement deletes of outdated metas and blocks. Here's how it work:

  1. Builders send back created metas to the planner
  2. Planner aggregates all the newly created metas for each table and tenant combination
  3. Looking at the original metas and the new ones, identify outdated metas
  4. Delete outdated metas along with their blocks

Special notes for your reviewer:

  • I refactored the planner.loadWork into planner.loadTenantWork which now returns a map of table->tenant->[]ownsershipBounds
  • Also refactored planner.RunOne to:
    1. Call planner.loadTenantWork
    2. Create and enqueue tasks for each table - tenant tuple. Computing the tasks remains the same.
    3. For each table - tenant tuple, call planner.processTenantTaskResults which will wait for all tenants to complete and handle deletion.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@salvacorts salvacorts force-pushed the salvacorts/bloom-refactor/planner-delete-tombstones branch from 4b73f9a to fc4f463 Compare June 6, 2024 10:24
@salvacorts salvacorts marked this pull request as ready for review June 6, 2024 11:37
@salvacorts salvacorts requested a review from a team as a code owner June 6, 2024 11:37
var wg sync.WaitGroup
for tt, results := range tasksResultForTableTenant {
wg.Add(1)
go func(table config.DayTable, tenant string, results tenantTableTaskResults) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may spawn quite a lot of goroutines.

Idea: Could we use a single results channel? I guess then the problem would be to know when a tenantTable is done, right?

Copy link
Contributor Author

@salvacorts salvacorts Jun 6, 2024

Choose a reason for hiding this comment

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

I guess then the problem would be to know when a tenantTable is done, right?

Correct.

This may spawn quite a lot of goroutines.

Indeed. On the other hand, I have this issue open for adding parallel workers to the planner. We can parallelize tenant-tables tuples across those workers and therefore limit the number of goroutines that would be spawned to wait for responses to the number of workers.

This would be similar to how the bloom-compactor currently handles parallelism:

err := concurrency.ForEachJob(ctx, c.cfg.WorkerParallelism, c.cfg.WorkerParallelism, func(ctx context.Context, idx int) error {

So I'd address this there. I'll add a TODO.

@salvacorts salvacorts merged commit 9c96d26 into main Jun 7, 2024
59 checks passed
@salvacorts salvacorts deleted the salvacorts/bloom-refactor/planner-delete-tombstones branch June 7, 2024 08:14
salvacorts added a commit that referenced this pull request Jun 7, 2024
@salvacorts salvacorts restored the salvacorts/bloom-refactor/planner-delete-tombstones branch June 7, 2024 09:22
@chaudum chaudum mentioned this pull request Aug 26, 2024
4 tasks
@salvacorts salvacorts deleted the salvacorts/bloom-refactor/planner-delete-tombstones branch December 20, 2024 10:17
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