Repository navigation
Conversation
ListKeySummaries decoded the value and ran the filters only for the first version of a key it walked, which is the oldest one. Later versions only updated the version and the sizes. So --fields=value and --template printed the oldest value, a filter matched against the oldest value, and a key whose oldest version did not match was counted again from its next version. Keep the raw value of the latest version while walking, then decode it and apply the filters once per key. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lbarrosby The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ListKeySummarieswalks the key bucket in revision order and builds the summary of a key from the first record it sees, which is the oldest version still in the db file. For later versions it only updatesVersion,ValueSizeand the counters. The value, the type meta and the filters are never looked at again, so:auger extract --fields=valueand--template '{{.Value...}}'print the oldest value of the key, not the one at the requested revision (or the latest);--filteris matched against the oldest value: a key whose old value matched is listed even if the current value does not;VersionCountis off by the skipped versions.This shows up on any db file that still has history for a key, for example a snapshot taken between two compactions.
Reproduction with a db that has two versions of one ConfigMap (
data.modeisoldat revision 2 andnewat revision 3):The walk now only collects stats and keeps the raw value of the latest version of each key (tombstones still drop the key). After the walk each remaining value is decoded once and the filters run on it. As a side effect only one value per key is decoded instead of the oldest one of every key, so the cost does not grow.
TestListKeySummariesUsesLatestValuecovers no filter, a filter on the latest value, a filter on an older value and--revisionpointing at the older version. On main the first three cases fail; with the change all pass.go test ./pkg/... ./cmd/...andgolangci-lint run --config tools/.golangci.yaml ./...are clean.AI disclosure: written with the help of Claude Code, reviewed and tested by me.