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

scdeps: tighten dependencies, log more side effects #73873

Merged
merged 1 commit into from
Dec 17, 2021

Conversation

postamar
Copy link
Contributor

This commit reworks the dependency injection for the event logger, among
other declarative schema changer dependencies. It also makes the test
dependencies more chatty in the side effects log.

Release note: None

@postamar postamar requested a review from a team December 15, 2021 20:43
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@postamar
Copy link
Contributor Author

@ajwerner this is the PR that relates to ajwerner@9d0010a

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

LGTM

for _, statementID := range statementIDs {
entries := eventLogEntriesForStatement(mvs.eventsByStatement[statementID])
for _, e := range entries {
if err := deps.EventLogger().LogEvent(ctx, e.id, *e.metadata, e.event); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to make this interface and call batched. We're pretty close to having that all line up. Happy to defer to a later PR. Thoughts on a TODO here or on the interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. I'll do what I can.

@@ -143,10 +145,11 @@ commit transaction #1
# begin PostCommitPhase
begin transaction #2
## PostCommitPhase non-revertible stage 1 of 1 with 11 MutationType ops
write *eventpb.DropSchema to event log for descriptor #57: DROP SCHEMA db.sc CASCADE
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we pull more structure out of this entry? How verbose would it be to print the whole entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At some point we should. Right now, adding more detail doesn't seem useful. I'm happy to be convinced otherwise, though.

sourceEvent := sourceEvents[subWorkID]
switch sourceEvent.event.(type) {
case *eventpb.DropDatabase:
// Drop database only reports dependent schemas.
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels so arbitrary. Is there some principle here? Do all dropped descriptors end up getting captured but I'm just missing how? Maybe printing the complete events in the end-to-end test will make it more obvious.

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 have a feeling that Faizan is working on this right now.

This commit reworks the dependency injection for the event logger, among
other declarative schema changer dependencies. It also makes the test
dependencies more chatty in the side effects log.

Release note: None
@postamar
Copy link
Contributor Author

Thanks for the review!

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 16, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 17, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 17, 2021

Build succeeded:

@craig craig bot merged commit 089affc into cockroachdb:master Dec 17, 2021
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