Repository navigation
Do not push a bucket while any input is still at it in GroupingAggregatedTransform - #115487
Conversation
`GroupingAggregatedTransform` pushes a delayed bucket as soon as no input reports it as delayed any more and every input has read it. Reading it is not enough: an input whose last chunk is of this bucket can send more chunks of the same bucket, the producer converts the aggregation variants of a bucket one by one. Those chunks arrive after the bucket is pushed, they are put into `chunks_map` again, and the bucket is merged and pushed a second time, which returns the keys of the bucket twice. The in order push next to it never had this: it pushes the buckets before `current_bucket`, and `current_bucket` only moves on when every input has read a bucket after it. Require the same here, every input has to be strictly past the bucket. `Bucket N is pushed twice` fires in the builds with the assertions, and the rows are silently duplicated in the release ones. Reproduced by `04605_pr_plan_based_count_distinct_serialized` in the stress and in the stateless runs with the distributed plan, where the merging of the plan based parallel replicas became memory efficient. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
A delayed bucket has to be pushed once even when no input ever reads a bucket after it, and a delayed bucket below the highest one still has to be pushed before the inputs finish. The driver of the test is shared by the cases now. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
Whatever the producers postpone and in whatever order their chunks arrive, every bucket has to be pushed exactly once and the transform has to finish. Being stricter about when a delayed bucket can be pushed may only postpone a push: the in order push and the drain of the finished inputs still take every bucket. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
|
Workflow [PR], commit [b9f4b26] Summary: ✅
AI ReviewSummaryThis PR tightens Final Verdict✅ No new findings. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 181/184 (98.37%) · Uncovered code |
An input which has finished cannot send more chunks of a bucket, so it does not have to be past the bucket for the bucket to be pushed. Taking it into account kept a bucket until the end of the query when a source ended right on it, although every input which can still send something had moved past it. An input port reports itself finished only when it has no data left on it, so nothing of the bucket is lost. Reported by review of #115264. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
`GroupingAggregatedTransform::prepare` takes the ports whose edge has changed, `ExecutingGraph::updateNode` collects them from the changed edges alone. The driver of the test reported every input on every call, so the transform saw a waiting port without data and dropped it from the waiting set, although the real executor stays in `NeedData` until that port really changes. The reproduction relied on that: it pushed the bucket in a state which does not happen in a pipeline. Report only the ports which were really given a chunk or finished. The reproduction is a producer which postponed buckets 6 and 7 and resolves them in order now, and never sends anything above 7, so `current_bucket` stays behind the bucket which is pushed. Reported by review of #115264. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BAZjq1jL3wNACqVQzocPoT
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units13 translation units recompiled, 60 s compile time in total, 13 of them have a recent master baseline. |
|
@nickitat the 26.7 backport #115782 does not build. On its current head 26.7 has the 7 parameter short Only the new gtest needs it: argument 8 at line 60, the file's only So dropping that argument on the backport branch is the small option. Labelling #112089 The 26.6 and 26.3 cherry-picks #115781 and #115779 are still unresolved and both branches carry the I do not hand-author or hand-resolve release-branch ports, so I am leaving this with you. |
… code The cherry-pick branch had master-only content (forgetOutOfOrderBucketsOfInput, getDelayedBucketsBefore, pushed_buckets, out_of_order_buckets in ChunksToMerge, etc.) that conflicts with the 26.6 backport branch. This commit brings the files to the correct state: the backport branch version plus only the everyLiveInputIsPastBucket fix from PR #115487. Co-authored-by: nickitat <[email protected]>
The previous conflict resolution inadvertently introduced conflict markers into unrelated files via a failed merge test. This commit: - Restores all unrelated files to the cherry-pick branch state (no conflict markers) - Keeps the correctly resolved cpp/h files: backport branch content + everyLiveInputIsPastBucket The two source files now differ from the backport branch by exactly the cherry-pick additions from PR #115487: - everyLiveInputIsPastBucket function + updated condition in the cpp - everyLiveInputIsPastBucket declaration in the h Co-authored-by: nickitat <[email protected]>
Cherry pick #115487 to 26.6: Do not push a bucket while any input is still at it in `GroupingAggregatedTransform`
…ll at it in `GroupingAggregatedTransform`
Backport #115487 to 26.6: Do not push a bucket while any input is still at it in `GroupingAggregatedTransform`
Backport #115487 to 26.7: Do not push a bucket while any input is still at it in `GroupingAggregatedTransform`
…put is still at it in `GroupingAggregatedTransform`
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
GroupingAggregatedTransformproducing duplicate chunks for the same bucket.Following up: #112794
Workflow [PR]
Sync PR [sync-upstream/pr/115487]
Version info
26.7.7.17,26.6.4.62