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

wal: fix CRC corruption on writes following write tears #6267

Merged
merged 3 commits into from
Aug 26, 2016

Conversation

heyitsanthony
Copy link
Contributor

No description provided.

Anthony Romano added 3 commits August 25, 2016 14:24
Whenever the WAL is opened for writes, it should write zeroes to its tail
starting from the first zero record. Otherwise, if there are entries past
the first zero record due to a torn write, any new writes that overlap the
old entries will lead to a garbage record on the tail and cause a CRC
mismatch.
}

b = make([]byte, 512)
if _, err = f.Read(b); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this for reading the next 512 bytes from os.SEEK_CUR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it's for checking that everything past SEEK_CUR was actually zero'd out

@gyuho
Copy link
Contributor

gyuho commented Aug 25, 2016

lgtm. Thanks!

Defer to @xiang90

@xiang90
Copy link
Contributor

xiang90 commented Aug 25, 2016

LGTM.

Before merging this, @gyuho can you run this patch with failpoint enabled and qps=2500?

@gyuho
Copy link
Contributor

gyuho commented Aug 25, 2016

@xiang90 Ok let me test run this with failpoints.

@xiang90
Copy link
Contributor

xiang90 commented Aug 26, 2016

@heyitsanthony Let's get this merged! Confirmed this fixed the wal corruption issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants