-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Conversation
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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
lgtm. Thanks! Defer to @xiang90 |
LGTM. Before merging this, @gyuho can you run this patch with failpoint enabled and qps=2500? |
@xiang90 Ok let me test run this with failpoints. |
@heyitsanthony Let's get this merged! Confirmed this fixed the wal corruption issue. |
No description provided.