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

fix(blooms): Ship chunkrefs in task payload #13677

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

salvacorts
Copy link
Contributor

@salvacorts salvacorts commented Jul 26, 2024

What this PR does / why we need it:
This PR adds series w/ chunkrefs to the task definition so builders do not need to download TSDBs to load the series and tasks.

We do this since if we are building blooms for the current day, as the compactor updates and deletes outdated TSDBs, builders may fail to load the referenced (already removed) TSDBs from the object store. This results in a task failure.

Notes:

  • Builders check here for chunks that are already in the blocks we reuse
    if nextInBlocks != nil && nextInBlocks.Series.Fingerprint == nextInStore.Fingerprint {
    // if the series already exists in the block, we only need to add the new chunks
    chunksToAdd = nextInStore.Chunks.Unless(nextInBlocks.Series.Chunks)
    chunksCopied += len(nextInStore.Chunks) - len(chunksToAdd)
    preExistingBlooms = nextInBlocks.Blooms
    }
  • The task payload may be way bigger now. If we find issues we can reduce the task payload size by issuing more tasks per tenant. But I don't expect this to be an issue at all.

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 changed the title Ship chunkrefs in task payload fix(blooms): Ship chunkrefs in task payload Jul 26, 2024
message ProtoGapWithBlocks {
ProtoFingerprintBounds bounds = 1 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "bounds"
];
repeated string blockRef = 2;
repeated ProtoSeries series = 2;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

During a rollout, this may make builders running an older version to fail to deserialize the task. This is fine: task will be retried and eventually the builder will restart.

@salvacorts salvacorts force-pushed the salvacorts/blooms/ship-chunkrefs-task branch from d07adce to 92d67f6 Compare July 26, 2024 11:03
@salvacorts salvacorts marked this pull request as ready for review July 26, 2024 11:09
@salvacorts salvacorts requested a review from a team as a code owner July 26, 2024 11:09
@salvacorts
Copy link
Contributor Author

salvacorts commented Jul 26, 2024

We were downloading and decompressing the TSDB for each gap. that was burning CPU. Fixed with 7d9c558 and bf6bf0c.

image
image

Comment on lines +31 to +34
message ProtoSeries {
uint64 fingerprint = 1;
repeated logproto.ShortRef chunks = 2;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This type is essentially the same as GroupedChunkRefs:

  uint64 fingerprint = 1;
  string tenant = 2;
  repeated ShortRef refs = 3;
}

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.

Might make the planner slower, but let's see.

LGTM

@salvacorts salvacorts merged commit 450bbce into main Jul 29, 2024
61 checks passed
@salvacorts salvacorts deleted the salvacorts/blooms/ship-chunkrefs-task branch July 29, 2024 09:11
@salvacorts salvacorts added type/bug Somehing is not working as expected backport k213 labels Jul 29, 2024
grafanabot pushed a commit that referenced this pull request Jul 29, 2024
benclive pushed a commit to cyriltovena/loki that referenced this pull request Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport k213 size/L type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants