-
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
*: add restriction to running DDL with internal executors #86334
Conversation
What should we do if the internal executor was constructed with a transaction and then a non-nil transaction is passed in? |
In the old design (prior to #82477), we don't construct an internal executor with a txn. Each time a not-nil txn passed in with a statement, we construct a conn executor with that txn. The internal executor is not bound to any txn at all. In the new interfaces, we actually didn't truly used the txn bounded to the internal executor ( Ideally, we should disallow passing a txn through the Ex functions, and always use |
217820f
to
ebb6736
Compare
I don't think the current simple |
Can you say more about why the check does not work? |
It feels like we need it to be the case that:
|
Maybe I gave the conclusion too fast -- it was because I saw it broke a great number of tests in the CI. But they were broken because it couldn't run
Yeah, it makes sense, will add them as well. (Though I have a stronger feeling that the new interface makes everything messier now 😥) |
If we want to apply this restriction, I think we still need to find out all existing DDL executions with not-nil txn, and let them either run with |
ebb6736
to
1325c82
Compare
1325c82
to
7e91991
Compare
b1057d9
to
24440da
Compare
Sorry for the noise, was fixing tiny nits in the CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. All my comments are minor nits
24440da
to
6fa85ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @dt, @shermanCRL, and @ZhouXing19)
pkg/ccl/backupccl/backup_test.go
line 8183 at r10 (raw file):
blobs.TestBlobServiceClient(dir), username.RootUserName(), nil, /* Internal Executor */
nit: the convention here (and for all other inline argument comments) would be to use the name of the parameter, but this isn't a huge deal
This is part of the migration of existing DDL statement with internal executor to `descs.CollectionFactory.TxnWithExecutor()`. DDL statements should only be run with an internal executor that's created via this function. Release justification: Low risk, high benefit changes to existing functionality Release note: none
fixes cockroachdb#76764 Release justification: Low risk, high benefit changes to existing functionality Release note: none
…r()` for DDLs This is part of the project to migrate existing DDL statements running with an internal executor to `descs.CollectionFactory()`. DDLs are only allowed to run with internal executor inited via this function. Release justification: Low risk, high benefit changes to existing functionality Release note: None
…tor()` for DDLs This commit is to migrate the existing DDLs to using `planner.WithInternalExecutor()`. DDLs with internal executors are only allowed if the latter is bounded with txn-realated metadata. Release justification: Low risk, high benefit changes to existing functionality Release note: none
…tor()` for DDLs This commit is part of the project to migrate DDLs running with internal executor with the correct interface. DDLs are only allowed to run with internal executor that is bound to txn-related metadata. Release justification: Low risk, high benefit changes to existing functionality Release note: none
We stripped `txn` from the parameter list in `cleanupTempSystemTables()`. It was run with not-nil txn by mistake, which is a mis-usage of running internal executor with DDLs. Release justification: bug fix Release note: none
This is another DDL statement executed via an internal executor mal-inited. Change it to use the right interface. Release justification: Release note: none.
…tor with txn When using internal executor to run DDL statements under a not-nil outer txn, we require txn-related metadata (such as descriptor collections) to be passed to the internal executor from the outer caller too. This commit is to add a gate for this use case. Release justification: bug fix Release note: none
It was causing the lint in CI to fail. Release note: None
6fa85ec
to
ebd6076
Compare
Previously, rafiss (Rafi Shamim) wrote…
Done, thanks! |
TFTR! |
Build failed (retrying...): |
Build succeeded: |
The current internal executor has its lifecycle, which makes it erroneous
when being used to execute DDL statements if under an outer txn.
In this commit, we
descs.CollectionFactory.TxnWithExecutor()
orplanner.WithInternalExecutor()
.Only internal executors inited via these 2 interfaces are bounded with txn-related
metadata, and hence are allowed to run DDLs in a transactional manner.
txn-related metadata.
fixes #87281
Release justification: bug fix for the internal executor
Release note: none