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/schemachanger: avoid generating event logs during EXPLAIN (DDL) #120563

Merged
merged 1 commit into from Mar 19, 2024

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Mar 15, 2024

Previously, the declarative schema changer could generate event log entries even when DDL was only being explained. This created a misleading impression that schema changes had been executed. This patch modifies the declarative schema changer to prevent instant logging of events. Instead, it returns a callback that can be executed before the statement phase.

Fixes: #118897

Release note (bug fix): EXPLAIN (DDL) would generate event log entries for schema changes even though they weren't executed.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@fqazi fqazi marked this pull request as ready for review March 15, 2024 22:36
@fqazi fqazi requested a review from a team as a code owner March 15, 2024 22:36
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

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


pkg/sql/schemachanger/scbuild/event_log.go line 57 at r1 (raw file):

}

func logEvents(

nit: should this be renamed to something like makeEventLogCallback

Previously, the declarative schema changer could generate event log
entries even when DDL was only being explained. This created a
misleading impression that schema changes had been executed. This patch
modifies the declarative schema changer to prevent instant logging of
events. Instead, it returns a callback that can be executed
before the statement phase.

Fixes: cockroachdb#118897

Release note (bug fix): EXPLAIN (DDL) would generate event log
entries for schema changes even though they weren't executed.
@fqazi
Copy link
Collaborator Author

fqazi commented Mar 19, 2024

@rafiss TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 19, 2024

@craig craig bot merged commit 99b05bd into cockroachdb:master Mar 19, 2024
21 of 22 checks passed
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.

sql/schemachanger: EXPLAIN on declarative schema changer statements generates event log entries
3 participants