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: fix data race in session serialization #90983

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

jordanlewis
Copy link
Member

Closes #90965

This commit fixes a data race in session serialization that was introduced by ac280a9.

Previously, the session serialization code attempted to read the original, parsed AST to create a redacted statement string. This is invalid because the AST is unfortunately not immutable, and serialization can occur concurrently with statement optimization and execution.

Now, the session serializer re-parses the original SQL to avoid this issue.

Release note: None

This commit fixes a data race in session serialization that was
introduced by ac280a9.

Previously, the session serialization code attempted to read the
original, parsed AST to create a redacted statement string. This is
invalid because the AST is unfortunately not immutable, and
serialization can occur concurrently with statement optimization and
execution.

Now, the session serializer re-parses the original SQL to avoid this
issue.

Release note: None
@jordanlewis jordanlewis requested a review from a team as a code owner October 31, 2022 15:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rafiss)

@jordanlewis
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 31, 2022

Build succeeded:

@craig craig bot merged commit e2de080 into cockroachdb:master Oct 31, 2022
@jordanlewis jordanlewis deleted the fix-list-session-race branch November 1, 2022 14:43
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: race condition writing to ResolvableFunctionReference.FunctionReference
3 participants