-
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
[WIP] sql: pass descs.Collection
to InternalExecutor
under planner context
#80262
[WIP] sql: pass descs.Collection
to InternalExecutor
under planner context
#80262
Conversation
efecba9
to
97ed700
Compare
descs.Collection
to InternalExecutor
for initializationdescs.Collection
to InternalExecutor
for initialization
7ce154a
to
e0d899f
Compare
e0d899f
to
28a76c7
Compare
This is neat. This change is very good for negating the efficiency problems we run into when we construct new internal executors for querying virtual tables, but it doesn't really mitigate issues like we saw in #76764. In order to have those work correctly we'd need to initialize and share also these parts of state: cockroach/pkg/sql/conn_executor.go Lines 1229 to 1240 in 928f605
In reality, I think sharing the descs.Collection for the purpose of writing is a bad idea. It's really good for when we're using the My preference would be that we find a way to hide the surface area more, and that we disable all schema changes using an internal executor with an explicit transactions, and then we just do this coupling for the internal executors accessed via the planner interface used in the EvalContext. Does that seem reasonable? |
descs.Collection
to InternalExecutor
for initializationdescs.Collection
to InternalExecutor
under planner context
51926ad
to
7630e51
Compare
a3db917
to
0137d18
Compare
66dbda3
to
c046563
Compare
Note to myself: The problem unsolved is that if under a planner context, the ie can still be initialized with I.e. we want to make the usage of |
Currently, when an internal executor is used inside a transaction under a planner context, it always creates a new descriptor collection rather than inheriting from the outer transaction. We'd like to pass `desc.Collection` to an internal executor ONLY when the internal executor is used under the planner context. To do this, we 1. introduced a type `extraTxnStateUnderPlanner`, which is only accessible under the sql package; 2. deprecate `ExecutorConfig.InternalExecutorFactory`, and break the internal executor initialization into 2 steps: a. under newSQLServer(), we initialize an `InternalExecutorProto`, which cannot be used to execute queries; b. initialize the true internal executor with `desc.Collection` via extraTxnStateUnderPlanner, if it's under the planner context. Fixes cockroachdb#69495 Release note: None
c046563
to
a7993a4
Compare
a7993a4
to
39370b5
Compare
39370b5
to
a7993a4
Compare
WIP
Currently, when an internal executor is used inside a transaction
under a
planner
context, it always creates a new descriptor collectionrather than inheriting from the outer transaction.
We'd like to pass
desc.Collection
to an internal executor ONLY whenthe internal executor is used under the planner context.
To do this, we
extraTxnStateUnderPlanner
, which is only accessibleunder the
sql
package;ExecutorConfig.InternalExecutorFactory
, and break the internalexecutor initialization into 2 steps:
a. under
newSQLServer()
, we initialize anInternalExecutorProto
, whichcannot be used to execute queries;
b. initialize the true internal executor with
desc.Collection
viaextraTxnStateUnderPlanner
, if it's under the planner context.Fixes #69495
Release note: None