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

changefeedccl, backupresolver: refactor to hold on to mapping of target to descriptor #79260

Merged

Conversation

HonoreDB
Copy link
Contributor

@HonoreDB HonoreDB commented Apr 1, 2022

Changefeed statements need to resolve a bunch of table names at once,
but unlike backups and grants they need to know which returned
descriptor corresponded to which input because they (now) take
target-specific options. We were reconstructing this awkwardly on
the calling side. This PR adds an optional parameter to the
backupresolver method being used so that it can track which
descriptor belongs to which input.

I'm probably being overly polite by making this optional,
but hey, it is a little extra memory footprint and not my package.

Release note: None

@HonoreDB HonoreDB requested a review from a team April 1, 2022 21:05
@HonoreDB HonoreDB requested a review from a team as a code owner April 1, 2022 21:05
@HonoreDB HonoreDB requested review from shermanCRL and removed request for a team April 1, 2022 21:05
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@shermanCRL shermanCRL requested a review from a team April 1, 2022 21:23
@HonoreDB HonoreDB force-pushed the use_resolver_to_match_descriptors branch 2 times, most recently from d75c933 to 5a4b7fc Compare April 2, 2022 14:44
@miretskiy miretskiy requested a review from stevendanna April 4, 2022 14:13
@@ -306,7 +306,7 @@ func NewDescriptorResolver(descs []catalog.Descriptor) (*DescriptorResolver, err
// session database) or if one of its tables matches the targets. All expanded
// DBs, via either `foo.*` or `DATABASE foo` are noted, as are those explicitly
// named as DBs (e.g. with `DATABASE foo`, not `foo.*`). These distinctions are
// used e.g. by RESTORE.
// used e.g. by RESTORE. tablePatternMap will be populated if non-nil.
Copy link
Contributor

Choose a reason for hiding this comment

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

is it really worth it to optimize? Perhaps just return this?

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.

@shermanCRL shermanCRL requested review from dt and removed request for shermanCRL April 4, 2022 14:23
Copy link
Member

@dt dt left a comment

Choose a reason for hiding this comment

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

not my package

At some point we should move this to pkg/sql/something, maybe pkg/sql/catalog/targets, since it doesn't really belong in backup's package either.

@HonoreDB HonoreDB force-pushed the use_resolver_to_match_descriptors branch 2 times, most recently from 0492326 to 37ee373 Compare April 5, 2022 17:55
@HonoreDB HonoreDB requested a review from miretskiy April 5, 2022 17:57
Copy link
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

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

I'd still prefer to tjust have 1 method. @dt also agrees.

…et to descriptor

Changefeed statements need to resolve a bunch of table names at once,
 but unlike backups and grants they need to know which returned
descriptor corresponded to which input because they (now) take
target-specific options. We were reconstructing this awkwardly on
the calling side. This PR adds a DescsByTablePattern map to the
 backupresolver method being used so that it can track which
 descriptor belongs to which input.

Release note: None
@HonoreDB HonoreDB force-pushed the use_resolver_to_match_descriptors branch from 37ee373 to 537edf0 Compare April 5, 2022 18:34
@HonoreDB
Copy link
Contributor Author

HonoreDB commented Apr 5, 2022

Okay, done.

@HonoreDB
Copy link
Contributor Author

HonoreDB commented Apr 5, 2022

bors r=[miretskiy,dt]

1 similar comment
@HonoreDB
Copy link
Contributor Author

HonoreDB commented Apr 5, 2022

bors r=[miretskiy,dt]

@craig
Copy link
Contributor

craig bot commented Apr 5, 2022

Already running a review

@craig craig bot merged commit b84398d into cockroachdb:master Apr 5, 2022
@craig
Copy link
Contributor

craig bot commented Apr 5, 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.

4 participants