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

Restrict the max size of each WAL entry to the remaining size of the WAL file #14122

Merged
merged 2 commits into from
Jun 17, 2022

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Jun 16, 2022

Fix issues/14114

Currently the max size of each WAL entry is hard coded as 10MB. If users set a value > 10MB for the flag
--max-request-bytes, then etcd may run into a situation that it successfully processes a big request, but fails to decode it when replaying the WAL file on startup.

On the other hand, we can't just remove the limitation, because if a WAL entry is somehow corrupted, and its recByte is a huge value, then etcd may run out of memory. So the solution is to restrict the max size of each WAL entry as a dynamic value, which is the remaining size of the WAL file.

Signed-off-by: Benjamin Wang wachao@vmware.com

The FileReader interface is the wrapper of io.Reader. It provides
the fs.FileInfo as well. The FileBufReader struct is the wrapper of
bufio.Reader, it also provides fs.FileInfo.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr ahrtr force-pushed the threshold_20220615 branch 2 times, most recently from e2d18a9 to 66ab73e Compare June 16, 2022 07:49
@ahrtr
Copy link
Member Author

ahrtr commented Jun 16, 2022

cc @ptabor @serathius @spzala Please take a look, thx.

…file

Currently the max size of each WAL entry is hard coded as 10MB. If users
set a value > 10MB for the flag --max-request-bytes, then etcd may run
into a situation that it successfully processes a big request, but fails
to decode it when replaying the WAL file on startup.

On the other hand, we can't just remove the limitation, because if a
WAL entry is somehow corrupted, and its recByte is a huge value, then
etcd may run out of memory. So the solution is to restrict the max size
of each WAL entry as a dynamic value, which is the remaining size of
the WAL file.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr
Copy link
Member Author

ahrtr commented Jun 17, 2022

Apart from the FileReader and FileBufReader, this PR should be a minor change, accordingly safe, so merging...

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

Successfully merging this pull request may close these issues.

Restriction on MaxRequestSize and maxWALEntrySize
2 participants