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

crl-release-24.1: wal: fix reader buffer reuse #3868

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

jbowens
Copy link
Collaborator

@jbowens jbowens commented Aug 20, 2024

While stitching together physical WAL segments, the WAL reader reads each record's contents into a temporary buffer. Previously, if an error was encountered mid-copy of a record (eg, because the record was large enough to be split across multiple chunks), the buffer was not reset before attempting to read the next file's record. This corruption could prevent replay of the WAL.

This commit fixes the bug moving the buffer reset to immediately precede its use.

Informs #3865.

While stitching together physical WAL segments, the WAL reader reads each
record's contents into a temporary buffer. Previously, if an error was
encountered mid-copy of a record (eg, because the record was large enough to be
split across multiple chunks), the buffer was not reset before attempting to
read the next file's record. This corruption could prevent replay of the WAL.

This commit fixes the bug moving the buffer reset to immediately precede its
use.

Informs cockroachdb#3865.
@jbowens jbowens requested review from a team and sumeerbhola August 20, 2024 15:18
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jbowens jbowens changed the title wal: fix reader buffer reuse crl-release-24.1: wal: fix reader buffer reuse Aug 20, 2024
Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 0 of 3 files reviewed, all discussions resolved

@jbowens
Copy link
Collaborator Author

jbowens commented Aug 20, 2024

TFTRs!

@jbowens jbowens merged commit 211dce0 into cockroachdb:crl-release-24.1 Aug 20, 2024
10 checks passed
@jbowens jbowens deleted the 24.1-wal-reuse branch August 20, 2024 17:04
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.

4 participants