-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 : check cluster id and fix data inconsistency #36672
Conversation
* extract all the precheck item implementations into a separate file
[REVIEW NOTIFICATION] This pull request has not been approved. 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. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/fb5f68f8e8a3a07c32fd61822e0158b855828cbc |
br/pkg/lightning/tikv/tikv.go
Outdated
return errors.Trace(err) | ||
} | ||
if id != clusterId { | ||
return errors.Errorf("Failed to match the cluster ID, please check whether pd-addr and status-port") |
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.
return errors.Errorf("Failed to match the cluster ID, please check whether pd-addr and status-port") | |
return errors.Errorf("Failed to match the cluster ID (`%s` from PD, `%s` from TiDB), please check whether pd-addr and status-port are correct", id, clusterId) |
const queryTiDB = "select substring(type,8) from METRICS_SCHEMA.PD_CLUSTER_METADATA limit 1;" | ||
tidbRow := db.QueryRowContext(ctx, queryTiDB) |
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.
one potential issue is that this won't work if PD has not enabled their Prometheus port.
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 have changed the comparing way of cluster id as description.
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: kennytm <kennytm@gmail.com>
i changed the comparing way of cluster id. 1. get cluster id from pd addr of config using `/pd/api/v1/cluster`; 2. get pd addr from tidb using `select STATUS_ADDRESS from information_schema.cluster_info where type='pd' limit 1;` 3. get cluster id from pd addr of queried from tidb; 4. compare result of the two value,if it's equal,it will continue.
i changed the comparing way of cluster id. 1. get cluster id from pd addr of config using `/pd/api/v1/cluster`; 2. get pd addr from tidb using `select STATUS_ADDRESS from information_schema.cluster_info where type='pd' limit 1;` 3. get cluster id from pd addr of queried from tidb; 4. compare result of the two value,if it's equal,it will continue.
update strconv.Iota to strconv.FormatInt
/run-build |
/close |
Issue Number: close #36653
What problem does this PR solve?
avoid table data inconsistency with table index.
What is changed and how it works?
/pd/api/v1/cluster
;select STATUS_ADDRESS from information_schema.cluster_info where type='pd' limit 1;
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.