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
153951: sql/export: refactor processors to implement RowSource interface r=yuzefovich a=yuzefovich
**distsql: harden infrastructure in some edge cases**
As part of looking into a nil pointer crash when rows produced by the
EXPORT were used as an input to the mutation (which is fixed in the
following commit), I noticed some problems with the distsql
infrastructure. In particular, in
f397730 we didn't properly implement
`Close` method for some processors (two EXPORT ones and the column
backfiller) which would mean possibly incomplete cleanup when the
processor never runs.
Additionally, the root cause of the panic was `nil` txn that previously
silently could've been set at the very end of the flow setup if
only at that point we decided that we need to create a leaf txn, yet
LeafTxnInputState was nil. That condition is expected in some cases
(when the flow is not running under a txn, like some bulk flows), yet
for EXPORT which runs under a txn, this was unexpected. This commit adds
an assertion for this.
Furthermore, if we hit an error at this point, we need to perform
cleanup differently from earlier error paths since we've already fully
set up the flow. This commit also adds that.
**sql/export: refactor processors to implement RowSource interface**
We recently found an edge case where the output of EXPORT was used as an
input to a mutation. Currently, in such a setup we have two goroutines
since the export processors don't implement `execinfra.RowSource`
interface, so we cannot fuse them with the mutation processor. Presence
of concurrency forces usage of the LeafTxns, yet mutations require
access to the RootTxn, thus we have conflicting requirements. Before the
previous commit we'd get a nil pointer crash, with the previous
commit in place we now get an assertion failure.
This commit solves this issue by refactoring both processors to
implement the `RowSource` interface. In the problematic query it allows
all processors to be fused together to run in a single goroutine, so we
can use the RootTxn as required by the mutation.
Release note (bug fix): Previously, EXPORT CSV and EXPORT PARQUET stmts
could result in a node crash when their result rows were used as the
input to a mutation like an INSERT within the same SQL. This bug has
been present since before 22.1 version and has now been fixed.
Fixes: #153292.
154123: drpc, server: implement filtering rules for server initialization state r=cthumuluru-crdb,shubhamdhama a=Nukitt
Previously, in DRPC, the `batch` RPC was able to access `node.Descriptor` which was yet to be initialized. This led to a data race, described in #153948.
This wasn't the case for gRPC, because of an interceptor that could filter RPCs during different server states. Particularly, it allows only bootstrap, heartbeat, health and gossip methods during initialization to prevent calls to potentially uninitialized services.
This patch adds this interceptor support into drpc as well. In-depth discussion on this: #153948 (comment)
Epic: None
Fixes: #153948
Release note: None
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Nukitt <[email protected]>
0 commit comments