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

sorter/leveldb(ticdc): separate write from table sorter #4686

Merged
merged 7 commits into from
Feb 26, 2022

Conversation

overvenus
Copy link
Member

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

  • Unit test

Release note

None

@overvenus overvenus added subject/performance Denotes an issue or pull request is related to replication performance. component/sorter Sorter component. area/ticdc Issues or PRs related to TiCDC. labels Feb 24, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 24, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • sdojjy
  • zhaoxinyu

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 24, 2022
Signed-off-by: Neil Shen <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2022

Codecov Report

Merging #4686 (fb1e5a7) into master (9607554) will decrease coverage by 0.5474%.
The diff coverage is 42.2577%.

Flag Coverage Δ
cdc 59.6327% <48.9983%> (-0.2896%) ⬇️
dm 51.2942% <32.2139%> (-0.7347%) ⬇️

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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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").
Copy link
Member

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,
Copy link
Member

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?

Copy link
Member Author

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.

"go.uber.org/zap"
)

// writer is a thin shim that batches, translates events into key vaule pairs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It's ok to noify reader immediately without waiting writes done,
// It's ok to notify reader immediately without waiting writes done,

@zhaoxinyu
Copy link
Contributor

/LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 25, 2022
Copy link
Member

@sdojjy sdojjy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 25, 2022
@overvenus
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: fb1e5a7

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 25, 2022
@zhaoxinyu
Copy link
Contributor

TestMySQLSinkFlushResovledTs failed.

@zhaoxinyu
Copy link
Contributor

/run-leak-test

@overvenus
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@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.

@overvenus
Copy link
Member Author

/run-kafka-integration-test
/run-integration-tests

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Feb 26, 2022
@overvenus
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: edeb755

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 26, 2022
@overvenus
Copy link
Member Author

/run-dm-compatibility-test
/run-kafka-integration-test

@ti-chi-bot ti-chi-bot merged commit fa006db into pingcap:master Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. component/sorter Sorter component. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. subject/performance Denotes an issue or pull request is related to replication performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants