-
Notifications
You must be signed in to change notification settings - Fork 283
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
config(dm): add on-duplicate-logical, on-duplicate-physical #7714
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
[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. |
/run-dm-integration-test |
Signed-off-by: lance6716 <lance6716@gmail.com>
/run-dm-integration-test |
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #7714 +/- ##
================================================
- Coverage 59.9034% 59.8604% -0.0430%
================================================
Files 810 810
Lines 93255 93185 -70
================================================
- Hits 55863 55781 -82
- Misses 32535 32543 +8
- Partials 4857 4861 +4 |
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.
rest lgtm
ImportMode LoadMode `yaml:"import-mode" toml:"import-mode" json:"import-mode"` | ||
OnDuplicate DuplicateResolveType `yaml:"on-duplicate" toml:"on-duplicate" json:"on-duplicate"` | ||
PoolSize int `yaml:"pool-size" toml:"pool-size" json:"pool-size"` | ||
Dir string `yaml:"dir" toml:"dir" json:"dir"` |
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.
The dir
seems a directory that maintains the export data. Do we need an extra config field for sst files?
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.
Thanks! I'll check it with PM later, maybe we need add more fields in future
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.
And also, lightning will check whether the source-dir and sst-dir are on the same disk (for IO performance sake, I think). I'm wondering if we should check it here
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.
precheck will be ported in another PR
// OnDuplicateNone represents do nothing when meet duplicate row and the task will continue. | ||
OnDuplicateNone PhysicalDuplicateResolveType = "none" | ||
// OnDuplicateManual represents that task should be paused when meet duplicate row to let user handle it manually. | ||
OnDuplicateManual PhysicalDuplicateResolveType = "manual" |
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.
I remember we have three duplicate resolutions in lightning:
# Physical Import Mode 设置是否检测和解决重复的记录(唯一键冲突)。
# 目前支持三种解决方法:
# - record: 仅将重复记录添加到目的 TiDB 中的 `lightning_task_info.conflict_error_v1` 表中。注意,该方法要求目的 TiKV 的版本为 v5.2.0 或更新版本。如果版本过低,则会启用下面的 'none' 模式。
# - none: 不检测重复记录。该模式是三种模式中性能最佳的,但是可能会导致目的 TiDB 中出现数据不一致的情况。
# - remove: 记录所有的重复记录,和 'record' 模式相似。但是会删除所有的重复记录,以确保目的 TiDB 中的数据状态保持一致。
# duplicate-resolution = 'none'
Are there any reasons we don't support it here?
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.
record is worse than remove in all respects so we delete it in design
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
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.
So we don't support "remove" in this version?
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.
"manual" is in fact "remove", it will remove the conflict KV first and let user query the recording table to decide to insert which row
dm/worker/subtask.go
Outdated
@@ -75,7 +75,7 @@ func createRealUnits(cfg *config.SubTaskConfig, etcdClient *clientv3.Client, wor | |||
|
|||
func newLoadUnit(cfg *config.SubTaskConfig, etcdClient *clientv3.Client, workerName string) unit.Unit { | |||
// tidb-lightning doesn't support column mapping currently | |||
if cfg.ImportMode == config.LoadModeLoader || cfg.OnDuplicate == config.OnDuplicateError || len(cfg.ColumnMappingRules) > 0 { | |||
if cfg.ImportMode == config.LoadModeLoader || len(cfg.ColumnMappingRules) > 0 { |
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.
I remember we have a NeedUseLightning
function. Can we reuse it here?
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.
Signed-off-by: lance6716 <lance6716@gmail.com>
ptal |
ptal @buchuitoudegou @okJiang |
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.
9/17 file
Dir string `yaml:"dir" toml:"dir" json:"dir"` | ||
SQLMode string `yaml:"-" toml:"-" json:"-"` // wrote by dump unit (DM op) or jobmaster (DM in engine) | ||
ImportMode LoadMode `yaml:"import-mode" toml:"import-mode" json:"import-mode"` | ||
// deprecated, use OnDuplicateLogical instead. |
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.
do we have any plan to remove the deprecated configuration?
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.
after all development is finished
Signed-off-by: lance6716 <lance6716@gmail.com>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 34911a8
|
@lance6716: 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. |
Signed-off-by: lance6716 lance6716@gmail.com
What problem does this PR solve?
Issue Number: ref #3510
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note