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

sql: vectorized stats collectors can finish prematurely #56928

Closed
RaduBerinde opened this issue Nov 19, 2020 · 1 comment · Fixed by #62255
Closed

sql: vectorized stats collectors can finish prematurely #56928

RaduBerinde opened this issue Nov 19, 2020 · 1 comment · Fixed by #62255
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@RaduBerinde
Copy link
Member

I am working on aggregating row counts for EXPLAIN ANALYZE (PLAN) and ran into some flaky plans. I traced it down to some vectorized stat collectors being finished (i.e. OutputStats() being called) early.

I managed to figure out a repro using this patch (repro instructions in there too).

In an instance of the repro, we have this plan.

According to various printf sprinkled around the code, I saw that the collector for TableReader/2 is called before we even emit a batch from that processor. The issue is that the collectors for TableReader/2 and HashJoiner/6 are in the same finishVectorizedStatsCollectors list and will finish together. In this case, it's possible that TableReader/3 finished without producing any rows that go to HashJoiner/6 which caused that processor to finish execution.

@RaduBerinde RaduBerinde added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Nov 19, 2020
@cockroachdb cockroachdb deleted a comment from blathers-crl bot Nov 19, 2020
@asubiotto asubiotto assigned asubiotto and unassigned yuzefovich Nov 23, 2020
@yuzefovich
Copy link
Member

yuzefovich commented Mar 17, 2021

I think I'm running into this a related problem with the first commit of #62126, so I'll look into this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
3 participants