This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
feat: append mlog in fixed-size blocks using log_appender #418
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
neverchanje
changed the title
refactor: append mlog in fixed-size blocks
feat: append mlog in fixed-size blocks
Mar 28, 2020
neverchanje
changed the title
feat: append mlog in fixed-size blocks
feat: append mlog in fixed-size blocks using log_appender
Mar 28, 2020
This comment has been minimized.
This comment has been minimized.
acelyc111
reviewed
Mar 30, 2020
hycdong
reviewed
Mar 31, 2020
src/dist/replication/lib/duplication/test/load_from_private_log_test.cpp
Outdated
Show resolved
Hide resolved
acelyc111
reviewed
Apr 1, 2020
neverchanje
force-pushed
the
mlog_block
branch
3 times, most recently
from
April 15, 2020 10:37
ccc68a9
to
7771797
Compare
feat: append mlog in fixed-size blocks using log_appender
acelyc111
approved these changes
Apr 16, 2020
hycdong
approved these changes
Apr 16, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current
mutation_log
implementation is unfriendly with such case:There're some writes being flushed into the disk, in the meantime, new incoming writes are pending in the
log_block
waiting to be flushed.As the pending
log_block
grows, it could be considerably large (like tens of MB) which is unfriendly for both replica recovery and duplication. I've met a bug while testing duplication that reading a large log block may cause tcmalloc to allocate an inaccessible memory.This PR limits the log block to 1MB using
log_appender
, reduces the possibility of large block related bug.log_appender
is a buffer for multiple log blocks. This PR doesn't change the behavior that all the pending writes will be flushed to disk (mutation_log::commit_pending_mutations
), no matter how large the size is. What changed is only the size of the log-block, so that reading the log block can be more smooth, without allocating large memory buffer.While the buffered writes went flushed (which blocks another flush), the incoming writes will be buffered in a new
log_appender
. The oldlog_appender
will be removed.