-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Support replace
mode for lightning post-import conflict detection
#45774
Labels
type/feature-request
Categorizes issue or PR as related to a new feature.
Comments
lyzx2001
added
the
type/feature-request
Categorizes issue or PR as related to a new feature.
label
Aug 2, 2023
/assign @lyzx2001 |
Merged
12 tasks
12 tasks
lyzx2001
changed the title
Support
Support Aug 14, 2023
replace
mode for lightning backend conflict detectionreplace
mode for lightning post conflict detection
lyzx2001
changed the title
Support
Support Aug 14, 2023
replace
mode for lightning post conflict detectionreplace
mode for lightning backend conflict detection
lyzx2001
changed the title
Support
Support Aug 30, 2023
replace
mode for lightning backend conflict detectionreplace
mode for lightning post-import conflict detection
12 tasks
13 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Is your feature request related to a problem? Please describe:
Currently lightning only supports
remove
mode for post-import conflict detection, but many customers request lightning to supportreplace
mode for lightning post-import conflict detection.Describe the feature you'd like:
replace
mode for lightning post-import conflict detection:To resolve rows with conflict, instead of deleting all the rows that are engaged in conflict (the algorithm for
remove
), we delete some rows with conflict and reserve other rows that can be kept and not cause conflict anymore. Under this circumstance, we only delete the necessary rows to resolve conflicts, so that we can keep more original rows thanremove
mode as long as the conflicts are resolved.For instance, we have the following table structure:
And we have 2 rows:
remove
mode would delete both 2 rows, butreplace
mode would only delete 1 row and reserve the other one.Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
Design documentation:
https://pingcap.feishu.cn/docx/XD52dwxfdoewUQxDDRtcdUq4nod?from=from_copylink
Implementation steps:
Change the structure of the tables that record data KV conflicts and index KV conflicts. Add index to track and search rows with conflict faster.
tidb/br/pkg/lightning/backend/local/duplicate.go
Lines 710 to 714 in 1e73eee
Use local backend import, set
duplicate-resolution = 'record'
to record the conflict rows but not delete them from downstream, manually use TiKV's API to extract information from the tables, and implement thereplace
algorithm to check the feasibility of the method.Modify
ResolveAllConflictKeys
function to support thereplace
algorithm that delete only the necessary rows to resolve conflict.tidb/br/pkg/lightning/backend/local/duplicate.go
Line 1012 in 1e73eee
Optimize executing logic and performance for the
replace
algorithm.The text was updated successfully, but these errors were encountered: