-
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
domain: stop schema validator to prohibit DML executing when tidb lost session of etcd #8441
Conversation
…t session of etcd
A schema change should meet either of the two conditions:
If none of the condition is satisfied, how could it change to a newer version 3 ?
We do not need to stop the schema validator, instead, we should stop the version change in the owner. @winkyao |
@winkyao Please add a test case. |
I'll add test cases. |
@tiancaiamao It is another issue, we can fix the issue you mentioned later, but not his PR. |
…into fix_schema_validator
…ffects the schema reloading.
LGTM |
@crazycs520 @zimulala PTAL |
/run-all-tests |
/run-common-test tidb-test=pr/668 |
/run-integration-common-test tidb-test=pr/668 |
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.
LGTM
What problem does this PR solve?
The etcd is responsible for schema synchronization, we should ensure there is at most two diffrent schema version in the TiDB cluster, to make the data/schema be consistent.
If we lost connection/session to etcd, the cluster will treats this TiDB as a down instance, and etcd will remove the key of
/tidb/ddl/all_schema_versions/tidb-id
.Say the schema version now is 1, the owner is changing the schema version to 2, it will not wait for this down TiDB syncing the schema, then continue to change the TiDB schema to version 3. Unfortunately, this down TiDB schema version will still be version 1. And version 1 is not consistent to version 3.
So we need to stop the schema validator to prohibit the DML executing when we lost session of etcd.
This PR revert partial changes of #7810
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)