ingest storage: cap number of bytes requested from kafka #13051
+33
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft
A test is failing and I believe it's because of an issue in franz-go twmb/franz-go#1139. I'll keep this in draft until that's resolved
Problem
it's possible that some fetches throw off our estimations for the bytes per record. The
fetchWantwill attempt to fetch the number of records it was given, but ifUpdateBytesPerRecordwas called by the fetcher worker in the snippet below with a very high average for each record, then it's possible that thefetchWantgoes over itstargetMaxBytesmimir/pkg/storage/ingest/fetcher.go
Line 762 in 1fdeb12
What this PR does
This PR renames the previous
targetMaxBytestomaxBytesLimitand enforces it in invocations toMaxBytes(). That way we also cap the memory usage of the fetcher worker.Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.