-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: panic in UPDATE with subquery (v2.0.6) #32054
Labels
A-sql-mutations
Mutation statements: UPDATE/INSERT/UPSERT/DELETE.
C-investigation
Further steps needed to qualify. C-label will change.
O-sentry
Originated from an in-the-wild panic report.
S-2-temp-unavailability
Temp crashes or other availability problems. Can be worked around or resolved by restarting.
Comments
tbg
added
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
O-sentry
Originated from an in-the-wild panic report.
labels
Oct 31, 2018
This is in v2.0.6 |
knz
added
the
S-2-temp-unavailability
Temp crashes or other availability problems. Can be worked around or resolved by restarting.
label
Oct 31, 2018
knz
changed the title
sentry: conn_executor.go:521: panic while executing 1 statements: UPDATE _ SET (_, _) = (SELECT (_ + $1), $2 FROM _ AS _ INNER JOIN _ AS _ ON _._ = _._ WHERE (_._ = $3) AND (_._ = _)) WHERE (_ = $3) AND ((_ + $1) >= _): caused by <redacted>
sql: panic in UPDATE with subquery (v2.0.6)
Nov 21, 2018
knz
added
C-investigation
Further steps needed to qualify. C-label will change.
and removed
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
labels
Nov 21, 2018
The panic is on the |
IIRC @BramGruneir fixed this in master/2.2; @awoods187 suggests to backport to 2.0. |
I don't even remember if I did. I remember looking into it.
…On Mon, Feb 11, 2019 at 11:54 AM kena ***@***.***> wrote:
IIRC @BramGruneir <https://github.com/BramGruneir> fixed this in
master/2.2; @awoods187 <https://github.com/awoods187> suggests to
backport to 2.0.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#32054 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABihuQhSOi4wLNeCBstHZgTab-y0Aw3zks5vMaBJgaJpZM4YDyo7>
.
|
Ok so I went and double checked and we corrected a panic for UPSERT, not UPDATE. I also double-checked and this code was not changed since 2.0, so if there's a bug there, it's still in |
Hah! found the bug. Both in |
This was referenced Feb 11, 2019
craig bot
pushed a commit
that referenced
this issue
Feb 12, 2019
34804: sql: prevent UPDATE from crashing if subquery returns no rows r=knz a=knz Fixes #32054. Note: only the heuristic planner was affected. The CBO was handling this case fine already. Release note (bug fix): When using `UPDATE SET (a,b) = (...subquery...)`, CockroachDb will not crash any more if the subquery returns no rows. Co-authored-by: Raphael 'kena' Poss <[email protected]>
craig bot
pushed a commit
that referenced
this issue
Feb 13, 2019
34801: sql: fix the subquery limit optimization r=knz a=knz Found this while investigating #32054. A while ago the HP was equipped with an optimization: when a subquery is planned for EXISTS or "max 1 row" (scalar context), a LIMIT is applied on its data source. This ensures that the data source does not fetch more rows than strictly necessary to determine the subquery result: - for EXISTS, only 0 or 1 row are needed to decide the boolean; - for scalar contexts, only 0, 1 or 2 rows are needed to decide the outcome 0 or 2 yield an error, only 1 gets a valid result. This optimization was temporarily broken for the scalar case when `max1row` was introduced (when local exec was subsumed by distsql), because the limit was remaining "on top" of `max1row` and not propagated down. This patch places it "under" so it gets propagated again. Release note (performance improvement): subqueries used with EXISTS or as a scalar value now avoid fetching more rows than needed to decide the outcome. Co-authored-by: Raphael 'kena' Poss <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-sql-mutations
Mutation statements: UPDATE/INSERT/UPSERT/DELETE.
C-investigation
Further steps needed to qualify. C-label will change.
O-sentry
Originated from an in-the-wild panic report.
S-2-temp-unavailability
Temp crashes or other availability problems. Can be worked around or resolved by restarting.
https://sentry.io/cockroach-labs/cockroachdb/issues/748121057/
conn_executor.go:521: panic while executing 1 statements: UPDATE _ SET (, ) = (SELECT ( + $1), $2 FROM _ AS _ INNER JOIN _ AS _ ON . = . WHERE (._ = $3) AND (. = )) WHERE ( = $3) AND ((_ + $1) >= _): caused by
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func2
The text was updated successfully, but these errors were encountered: