Skip to content

sql: fix data race in session serialization#90983

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
jordanlewis:fix-list-session-race
Oct 31, 2022
Merged

sql: fix data race in session serialization#90983
craig[bot] merged 1 commit intocockroachdb:masterfrom
jordanlewis:fix-list-session-race

Conversation

@jordanlewis
Copy link
Copy Markdown
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 review from a team, ajwerner and rafiss October 31, 2022 15:00
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

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:

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

TFTR!

bors r+

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