Merge pull request #18850 from roidelapluie/roidelapluie/fix-fill-lhs-matched-sigs
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests for 32-bit x86 (push) Waiting to run
CI / Go tests for Prometheus upgrades and downgrades (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

promql: fix stale matchedSigs maps breaking fill_left in range queries
This commit is contained in:
Julien 2026-06-04 16:28:44 +02:00 committed by GitHub
commit afec04d3f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -3221,7 +3221,7 @@ func (ev *evaluator) VectorBinop(op parser.ItemType, lhs, rhs Vector, matching *
sigOrd := rhsh[i].sigOrdinal
if (matching.Card == parser.CardOneToOne && matchedSigsPresent[sigOrd]) ||
(matching.Card != parser.CardOneToOne && matchedSigs[sigOrd] != nil) {
(matching.Card != parser.CardOneToOne && len(matchedSigs[sigOrd]) > 0) {
continue // Already matched.
}
ls := Sample{

View file

@ -309,6 +309,21 @@ eval range from 0 to 20m step 5m intermittent_left + fill_left(0) intermittent_r
{label="b"} 100 _ 300 _ 500
{label="c"} 1000 _ _ 4000 5000
# Regression test: group_left fill_left in a range query must apply fill values
# at every timestep, even when the RHS sigOrd was matched at a previous timestep.
# resetMatchedSigs previously used clear() which left non-nil empty maps, causing
# the fill-LHS path to incorrectly skip unmatched RHS samples on subsequent timesteps.
clear
load 5m
matched_lhs{key="a"} 1 _ 3
matched_rhs{key="a"} 10 20 30
matched_rhs{key="b"} 100 200 300
eval range from 0 to 10m step 5m matched_lhs + on(key) group_left fill_left(0) matched_rhs
{key="a"} 11 20 33
{key="b"} 100 200 300
# ---------- fill with vectors where one side is empty ----------
clear