-
Notifications
You must be signed in to change notification settings - Fork 287
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
sorter/leveldb(ticdc): separate write from table sorter #4686
Conversation
Signed-off-by: Neil Shen <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: Neil Shen <[email protected]>
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #4686 +/- ##
================================================
- Coverage 55.6402% 55.0927% -0.5475%
================================================
Files 494 513 +19
Lines 61283 63718 +2435
================================================
+ Hits 34098 35104 +1006
- Misses 23750 25133 +1383
- Partials 3435 3481 +46 |
InputEvent *model.PolymorphicEvent | ||
// Latest resolved ts / commit ts for readers. | ||
// writer -> reader | ||
ReadTs ReadTs |
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.
It makes the logic complex and unreadable to add so many fields in one struct, some fields are always nil in some cases.
And the Task
is a part of Message
, The size will be larger and larger, maybe we should find a better way to extend the Task
or Message
.
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.
It's good point! Ideally tasks should be an enum type in rust, so tasks can be separated and more readable. Unfortunately, golang does not support it.
And the Task is a part of Message, The size will be larger and larger, maybe we should find a better way to extend the Task or Message.
Maybe we should make Task be a pointer in Message? Though it makes memory allocation, not sure if it helps performance.
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.
Also see, notes in #4631
@@ -68,10 +70,14 @@ func NewSystem(dir string, memPercentage float64, cfg *config.DBConfig) *System | |||
WorkerNumber(cfg.Count).Build() | |||
compactSystem, compactRouter := actor.NewSystemBuilder("sorter-compactor"). | |||
WorkerNumber(cfg.Count).Build() | |||
writerSystem, writerRouter := actor.NewSystemBuilder("sorter-writer"). |
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.
we have sorter-db
and sorter-writer
, can you add some comments about sorter-db
TableID: w.tableID, | ||
ReadTs: message.ReadTs{ | ||
MaxCommitTs: maxCommitTs, | ||
MaxResolvedTs: maxResolvedTs, |
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.
maybe the write task is not finished, is it ok to send maxResolvedTs
to the reader?
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.
Yes, as reader/writer send tasks to the same leveldb, so tasks are ordered.
ReadTs will trigger reader to take iterator from leveldb, it happens after writer sends writes to leveldb.
And before leveldb takes iterators, it flushed all pending writes, so iterators see all writes.
cdc/sorter/leveldb/writer.go
Outdated
"go.uber.org/zap" | ||
) | ||
|
||
// writer is a thin shim that batches, translates events into key vaule pairs |
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.
// writer is a thin shim that batches, translates events into key vaule pairs | |
// writer is a thin shim that batches, translates events into key-value pairs |
Signed-off-by: Neil Shen <[email protected]>
|
||
// Notify reader that there is something to read. | ||
// | ||
// It's ok to noify reader immediately without waiting writes done, |
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.
// It's ok to noify reader immediately without waiting writes done, | |
// It's ok to notify reader immediately without waiting writes done, |
/LGTM |
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.
lgtm
/merge |
This pull request has been accepted and is ready to merge. Commit hash: fb1e5a7
|
TestMySQLSinkFlushResovledTs failed. |
/run-leak-test |
/merge |
@overvenus: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/run-kafka-integration-test |
Signed-off-by: Neil Shen <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: edeb755
|
/run-dm-compatibility-test |
What problem does this PR solve?
Issue Number: ref #4631
What is changed and how it works?
It separate write from table sorter.
Note, for now it's dead code, will be enabled in later PRs.
Check List
Tests
Release note