You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
156110: sql: harden DistSQL interactions with routines r=yuzefovich a=yuzefovich
**sql: unconditionally check DistSQL supportability**
This commit hardens c17591e. In
particular, in that change we disabled the usage of the Streamer
whenever some part of the plan isn't distributable. However, population
of `distSQLProhibitedErr` was left on a best-effort basis. In
particular, if we have `distsql=off` (as well as a couple of other
conditions), we'd skip the supportability check. This meant that we
could still end up using the Streamer in some illegal cases - one
example that I came up with is if we have a routine (which currently
prohibits distsql), it might access the RootTxn concurrently with the
LeafTxn access by the Streamer, which is no bueno. This commit makes it
so that we do DistSQL supportability check unconditionally. Note that
this shouldn't really have a performance impact - after all, we do
expect this check to be done pretty much all the time (unless someone
runs with `distsql=off`).
Additionally, this change happens to fix a nil pointer error around the
recent fix to top-level query stats in presence of routines. Namely,
that patch only set the metadata forwarder for local plans if we end up
using the RootTxn, but in a query where we happened to use the streamer
with routines, (before this patch) we'd end up with LeafTxn and unset
metadata forwarder. Now we'll have streamer disabled, so we'll have the
RootTxn and the forwarder will be set.
Fixes: #155955.
**sql: harden recent fix to top-level query stats with routines**
This commit relaxes the requirements for when it's safe to set the
routine metadata forwarder. Previously, we only set it when we end up
using the RootTxn in a local plan, but now we examine all possible kinds
of concurrency within the local plan to see whether it's actually safe
to set the metadata forwarder. This seems like a nice cleanup as well.
Note that this commit independently fixes the issue mentioned in the
previous commit.
Release note: None
Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
0 commit comments