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

Lightning: Improve Fail-Fast Behavior for max-error.conflict Configuration #42471

Open
dsdashun opened this issue Mar 22, 2023 · 2 comments
Open
Labels
component/lightning This issue is related to Lightning of TiDB. type/enhancement The issue or PR belongs to an enhancement.

Comments

@dsdashun
Copy link
Contributor

Enhancement

Currently, there is a configuration setting called max-error.conflict that restricts the maximum number of conflict errors for a Lightning task. However, currently this check is performed only when recording the conflict records into the meta table, after all the conflict data has already been constructed by the pebble DB and written into TiKV. If there are many conflicts, constructing all that conflict data can be very time-consuming. To address this, we propose that, during the construction of KV data, if the number of conflict records hits the max-error.conflict threshold, the entire import process should be halted and all the conflict records should be recorded into the meta table. This way, we can ensure that the max-error.conflict configuration can truly make the Lightning fail fast.

@dsdashun dsdashun added the type/enhancement The issue or PR belongs to an enhancement. label Mar 22, 2023
@dsdashun
Copy link
Contributor Author

/component lightning

@ti-chi-bot ti-chi-bot added the component/lightning This issue is related to Lightning of TiDB. label Mar 22, 2023
@okJiang
Copy link
Member

okJiang commented Mar 22, 2023

also need to add

if em.remainingError.Conflict.Load() <= 0 {
	return nil
}

before

if em.remainingError.Conflict.Sub(int64(len(conflictInfos))) < 0 {

Otherwise, we may write duplicate data into downstream for every task when em.remainingError.Conflict.Load() <= 0. It is unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/lightning This issue is related to Lightning of TiDB. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants