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/contention/txnidcache: avoid recording nil txnID #77502

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

Azhng
Copy link
Contributor

@Azhng Azhng commented Mar 8, 2022

Resolves #77371

Previously, there are edge cases where the txnID in the resolvedTxnID
emitted from connExecutor will be nil, (e.g. when the connExecutor closes
while a transaction is still active). Writing invalid txnID into the
writer can potentially cause data loss, since the TxnID cache stops
processing the input batch when it encounters the first invalid txnID.
This commit prevents invalid txnID from being written into TxnID Cache.

Release justification: bug fix to existing functionality
Release note: None

@Azhng Azhng requested a review from a team March 8, 2022 19:15
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Can you add tests for this case?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Resolves cockroachdb#77371

Previously, there are edge cases where the txnID in the resolvedTxnID
emitted from connExecutor will be nil, (e.g. when the connExecutor closes
while a transaction is still active). Writing invalid txnID into the
writer can potentially cause data loss, since the TxnID cache stops
processing the input batch when it encounters the first invalid txnID.
This commit prevents invalid txnID from being written into TxnID Cache.

Release justification: bug fix to existing functionality
Release note: None
@Azhng
Copy link
Contributor Author

Azhng commented Mar 8, 2022

Test added.

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Great :lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@Azhng
Copy link
Contributor Author

Azhng commented Mar 9, 2022

TFTR!

bors r=maryliag

@craig
Copy link
Contributor

craig bot commented Mar 9, 2022

Build succeeded:

@craig craig bot merged commit a161490 into cockroachdb:master Mar 9, 2022
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: txnID of the active txn not properly captured when connExecutor closes
3 participants