-
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
lightning: remove post-import conflict detection "remove" and "record" semantic, and add "error" semantic #50806
lightning: remove post-import conflict detection "remove" and "record" semantic, and add "error" semantic #50806
Conversation
Hi @lyzx2001. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #50806 +/- ##
================================================
+ Coverage 70.4926% 73.8217% +3.3291%
================================================
Files 1463 1469 +6
Lines 433262 453671 +20409
================================================
+ Hits 305418 334908 +29490
+ Misses 108580 98093 -10487
- Partials 19264 20670 +1406
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
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.
/hold
need to address comment
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/test pull-lightning-integration-test |
@lyzx2001: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
/cc @3pointer |
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
_, gCtx := errgroup.WithContext(ctx) | ||
|
||
kvRows, err := em.db.QueryContext( | ||
gCtx, common.SprintfWithIdentifiers(selectConflictKeysCountError, em.schema), |
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.
no need to query the count(*). we can query all data and check if result is empty
// ResolveConflictKeysError query all conflicting rows (handle and their | ||
// values) from the current error report and return error | ||
// if the number of the conflicting rows is larger than 0. | ||
func (em *ErrorManager) ResolveConflictKeysError( |
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 better we implement the "error" setting in dupeController.CollectRemoteDuplicateRows
. That function will fail earlier when see the first error. In this location we will record all errors which may cost a lot.
You can open another PR to do it.
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.
OK. Will implement in the next PR.
! run_lightning --backend local --config "${mydir}/config.toml" | ||
[ $? -eq 0 ] | ||
|
||
tail -n 10 $TEST_DIR/lightning.log | grep "ERROR" | tail -n 1 | grep -Fq "[Lightning:Restore:ErrFoundDuplicateKey]found duplicate key" |
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 you also check the output key is human readable? also ask PM what's the expected format.
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.
Here I conform to the output for the error
mode of preprocess detection
tidb/br/pkg/lightning/common/dupdetect.go
Lines 96 to 102 in a465300
if d.option.ReportErrOnDup { | |
dupKey := make([]byte, len(d.curKey)) | |
dupVal := make([]byte, len(val)) | |
copy(dupKey, d.curKey) | |
copy(dupVal, d.curVal) | |
return nil, nil, false, ErrFoundDuplicateKeys.FastGenByArgs(dupKey, dupVal) | |
} |
I think users want unified output no matter the conflicts come from preprocess detection or post-import detection.
Let me check with PM for this.
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.
Currently the output looks like this
[error="[Lightning:Restore:ErrFoundDuplicateKey]found duplicate key 't\ufffd\u0000\u0000\u0000\u0000\u0000\u0000l_r\ufffd\u0000\u0000\u0000\u0000\u0000\u0000\u0001', value '\ufffd\u0000\u0002\u0000\u0000\u0000\u0002\u0003\u0001\u0000\u0006\u0000\u00061.csv'"]
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.
"error" is only internally used before, it does not consider human-readability.
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.
DDL uses "error" option before, and has extra work to extract the data, like
if common.ErrFoundDuplicateKeys.Equal(err) {
err = convertToKeyExistsErr(err, indexInfo, tbl.Meta())
}
We can mimic it or we directly read other fields from the conflict error table and display them to user. Please be careful do not break DDL's behaviour.
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.
Will address in next PR.
/unhold |
/cc @Leavrth |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, lance6716, Leavrth The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: ref #51036
Problem Summary:
Merge preprocess duplicate detection and post-import conflict detection.
What changed and how does it work?
Remove post-import conflict detection "remove" and "record" semantic, and add "error" semantic.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.