-
Notifications
You must be signed in to change notification settings - Fork 289
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
schema(cdc): refactor schema snapshot to reduce memory usage #5144
Conversation
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[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: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
d31a705
to
d436465
Compare
Signed-off-by: qupeng <[email protected]>
d436465
to
3eea023
Compare
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
/run-all-tests |
cdc/entry/schema/snapshot.go
Outdated
id int64 | ||
tag uint64 | ||
// the associated entity pointer. | ||
target unsafe.Pointer |
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.
Can it be interface{}?
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
…chema-snapshot-cow-1
/merge |
@hicqu: In response to this:
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 please take a look again and /merge it if you are free. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 826f9e4
|
/run-leak-test |
What problem does this PR solve?
Issue Number: close #1386
What is changed and how it works?
Ticdc keeps all versions of schema snapshot for each DDL, and it can only GC them after its checkpoint is advanced. If there are too many DDLs, the checkpoint advancing can be very slow so that all versions of schema snapshot are kept in memory.
Without the PR schema snapshots are deep cloned from the previous one. With the patch all schema snapshots share one MVCC tree to avoid deep clone. This is why memory usage is reduced in the PR.
Check List
Tests
Create 12K tables WITH THE PATCH:
![图片](https://user-images.githubusercontent.com/8407317/162911109-bde6f230-dcdb-48b0-95b9-8d0d723d1131.png)
Create 12K tables WITHOUT THE PATCH:
![图片](https://user-images.githubusercontent.com/8407317/162917284-06fd02ba-d1ea-4fa9-9f06-629fc275f9e8.png)
Code changes
Side effects
Related changes
Release note