Batch apply dml events #352
Merged
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.
This PR applies DML events (events read from the binary logs) in batches, i.e. it aggregates events from the binary log and writes multiple DMLs (
insert,delete,update) in a single transaction.This has the potential to increase
gh-ost's write capacity. This would potentially help #348, though we have not yet diagnosed #348 enough.The PR introduces a
--dml-batch-sizeflag, default10.Noteworthy about the implementation:
gh-ostdoes not wait for events to arrive in order to batch. The logic is as follows:dml-batch-size. Of these, only handle the prefix that is true DML events (distinguished fromgh-ost's internal events).So the logic doesn't block on waiting for "more events to arrive", but is greedy, and takes as many available events as there are, up to some limit, and only in suh case that there are events to apply.