Skip to content
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

spanconfigsqltranslator: add sqlutil.InternalExecutor to SQLTranslator #91401

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

ZhouXing19
Copy link
Collaborator

@ZhouXing19 ZhouXing19 commented Nov 7, 2022

This commit is part of the effort of having an internal executor better bound to its outer txn if there's one.

The next step after this commit is to replace the executor used in s.ptsProvider.GetState() in SQLTranslator.Translate() to the one hanging off SQLTranslator.

Informs: #91004

Release note: None

@ZhouXing19 ZhouXing19 requested a review from a team as a code owner November 7, 2022 14:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ZhouXing19)


pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go line 46 at r1 (raw file):

	txn      *kv.Txn
	descsCol *descs.Collection
	ie       sqlutil.InternalExecutor

nit: could you add a TODO here about its intended use if you're not planning on making use of it in this patch?


pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go line 72 at r1 (raw file):

// NewSQLTranslator constructs and returns a transaction-scoped
// spanconfig.SQLTranslator. The caller must ensure that the collection passed
// in is associated with the supplied transaction.

nit: Could you update this comment to now reference the internal executor as well? Something like "The caller must ensure that the passed in collection, internal executor, and transaction are associated with each other"?

Copy link
Collaborator Author

@ZhouXing19 ZhouXing19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arulajmani for reviewing! I made a txnBundle struct to emphasize that the descriptor collection, internal execuot and the txn should be associated with each other. Do you think this may be better?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani)


pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go line 46 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: could you add a TODO here about its intended use if you're not planning on making use of it in this patch?

Done.


pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go line 72 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: Could you update this comment to now reference the internal executor as well? Something like "The caller must ensure that the passed in collection, internal executor, and transaction are associated with each other"?

Done.

This commit is part of the effort of having an internal executor better bound
to its outer txn if there's one.

The next step after this commit is to replace the executor used in
`s.ptsProvider.GetState()` in `SQLTranslator.Translate()` to the one hanging
off `SQLTranslator`.

Release note: None
@ZhouXing19
Copy link
Collaborator Author

The added change is pretty small so I'll just merge it.
Thanks for reviewing!
bors r=arulajmani

@craig
Copy link
Contributor

craig bot commented Nov 8, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Nov 8, 2022

This PR was included in a batch that was canceled, it will be automatically retried

@craig craig bot merged commit 2e90394 into cockroachdb:master Nov 8, 2022
@craig
Copy link
Contributor

craig bot commented Nov 8, 2022

Build succeeded:

@arulajmani
Copy link
Collaborator

Sorry, I just saw this notification. I'm all for the txnBundle change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants