Skip to content

scdeps: tighten dependencies, log more side effects#73873

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
postamar:more-side-effects
Dec 17, 2021
Merged

scdeps: tighten dependencies, log more side effects#73873
craig[bot] merged 1 commit intocockroachdb:masterfrom
postamar:more-side-effects

Conversation

@postamar
Copy link
Copy Markdown

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
Copy Markdown
Member

This change is Reviewable

@postamar
Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

# 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

Thanks for the review!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 16, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 17, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
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