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

sql/sem/tree: break dependencies on catalog, sessiondata, security #80687

Merged
merged 11 commits into from
May 2, 2022

Conversation

ajwerner
Copy link
Contributor

This pile of commits moves stuff and makes some minor changes to break more dependencies of tree. Most of the commits are totally mechanical. The ones which aren't relate to abstracting SearchPath a tad and moving cast options to a struct. This should be straightforward to review commit-by-commit.

The end goal here will be to break the dependencies of the parser on util/log. There's still a few more things remaining here and there, but this felt like a reasonable stopping point.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@ajwerner ajwerner force-pushed the ajwerner/remove-catalog-from-tree branch from 92cbcea to f4a77d3 Compare April 28, 2022 05:31
@ajwerner ajwerner marked this pull request as ready for review April 28, 2022 05:31
@ajwerner ajwerner requested review from a team as code owners April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team as a code owner April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team April 28, 2022 05:31
@ajwerner ajwerner requested review from a team as code owners April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team as a code owner April 28, 2022 05:31
@ajwerner ajwerner requested a review from a team April 28, 2022 05:31
@ajwerner ajwerner requested review from a team as code owners April 28, 2022 05:31
@ajwerner ajwerner requested review from shermanCRL and stevendanna and removed request for a team April 28, 2022 05:31
iter := sp.Iter()
for schema, ok := iter.Next(); ok; schema, ok = iter.Next() {
if err := f(schema); err != nil {
if iterutil.Done(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this iter package is cool

@@ -35,6 +35,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/sqlerrors"
"github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry"
"github.com/cockroachdb/cockroach/pkg/sql/username"
Copy link
Contributor

Choose a reason for hiding this comment

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

this import confused me when i reviewed this commit but got lost somewhere. i don't know if you want to fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this.

// PublicSchemaID redefines keys.PublicSchemaID to avoid an import. It exists
// to deal with time-travel queries from moments before the time when all
// databases other than system were given a public schema.
const PublicSchemaID = 29
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe it belongs to pkg/base??? :trollface:

@ajwerner ajwerner force-pushed the ajwerner/remove-catalog-from-tree branch from f4a77d3 to 86be457 Compare April 28, 2022 13:09
@otan
Copy link
Contributor

otan commented Apr 28, 2022

Merge away if CI is green

@ajwerner ajwerner force-pushed the ajwerner/remove-catalog-from-tree branch 6 times, most recently from 5fd0fc9 to 761e0b7 Compare May 2, 2022 05:16
@ajwerner ajwerner requested a review from a team as a code owner May 2, 2022 13:25
@ajwerner ajwerner force-pushed the ajwerner/remove-catalog-from-tree branch from 8991138 to da24e5d Compare May 2, 2022 17:48
ajwerner added 11 commits May 2, 2022 14:59
It was big and obscuring the rest of the logic.

Release note: None
No reason to involve sessiondata down in tree. Note that this is all probably
moot because we're removing these options, but I didn't want to be the one to
do that right now.

Release note: None
The security package depends on logging amongst other things. This is easy to
break as the methods were really just about string conversions. Also we needed
sessiondata here.

Release note: None
Tree and protobuf packages like sessiondatapb imported security just for the
SQLUsername symbol and its associated proto symbol. There's no need for that.
This was a purely automated move.

Release note: None
Before this if we disallowed a prefix for imports and the package was itself
under that prefix, the test would fail. Now we remove the package itself.

Release note: None
It should just be constants.

Release note: None
This is just constants. We want tree to be free of catalog.

Release note: None
@ajwerner ajwerner force-pushed the ajwerner/remove-catalog-from-tree branch from da24e5d to a53fad6 Compare May 2, 2022 18:59
@ajwerner
Copy link
Contributor Author

ajwerner commented May 2, 2022

TFTR!

bors r+

@craig craig bot merged commit 480c3e4 into cockroachdb:master May 2, 2022
@craig
Copy link
Contributor

craig bot commented May 2, 2022

Build succeeded:

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