Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

check cluster id and fix data inconsistency #1475

Closed
wants to merge 1 commit into from
Closed

check cluster id and fix data inconsistency #1475

wants to merge 1 commit into from

Conversation

AricSu
Copy link

@AricSu AricSu commented Jul 27, 2022

Issue Number: close #1473

What problem does this PR solve?

avoid table data inconsistency with table index.

What is changed and how it works?

  1. get cluster id from tidb port using select substring(type,8) from METRICS_SCHEMA.PD_CLUSTER_METADATA limit 1;
  2. get cluster id from pd api using /pd/api/v1/cluster
  3. compare result of the two value,if it's equal,it will continue.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release note

@ti-chi-bot
Copy link
Member

[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 /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@AricSu
Copy link
Author

AricSu commented Jul 27, 2022

could you tell me the reason why about integration_test CI error as below?
@3pointer

[2022-07-27T21:51:17.953Z] + git checkout -f 16d0852feb9a23d13cdd321cb8eccc35c7c2a627
[2022-07-27T21:51:17.954Z] fatal: reference is not a tree: 16d0852feb9a23d13cdd321cb8eccc35c7c2a627
script returned exit code 128

@AricSu
Copy link
Author

AricSu commented Jul 27, 2022

in manual build and test,I've passed it using the mini reproduce step in issue #1473:

[tidb@172-16-120-122 ~]$ ./tidb-lightning -c lightning.toml 
Verbose debug logs will be written to tidb-lightning.log

+---+---------------------------------+-------------+--------+
| # | CHECK ITEM                      | TYPE        | PASSED |
+---+---------------------------------+-------------+--------+
| 1 | Source csv files size is proper | performance | true   |
+---+---------------------------------+-------------+--------+
| 2 | checkpoints are valid           | critical    | true   |
+---+---------------------------------+-------------+--------+
| 3 | table schemas are valid         | critical    | true   |
+---+---------------------------------+-------------+--------+

+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| # | CHECK ITEM                                                                                                           | TYPE        | PASSED |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 1 | Source csv files size is proper                                                                                      | performance | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 2 | checkpoints are valid                                                                                                | critical    | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 3 | table schemas are valid                                                                                              | critical    | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 4 | cluster available check failed: Failed to match the cluster ID, Please check whether status-port is correct          | critical    | false  |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 5 | Lightning has the correct storage permission                                                                         | critical    | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 6 | sorted-kv-dir:./some_dir and data-source-dir:/home/tidb/sbtest1_dump are in the same disk, may slow down performance | performance | false  |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 7 | local disk resources are rich, estimate sorted data size 252.6KiB, local available is 809.8GiB                       | critical    | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 8 | Cluster capacity is rich, capacity is 2.566TiB, we need 757.7KiB                                                     | critical    | true   |
+---+----------------------------------------------------------------------------------------------------------------------+-------------+--------+
1 critical check failed,1 performance check failedError: tidb-lightning pre-check failed. Please fix the failed check(s) or set --check-requirements=false to skip checks
tidb lightning encountered error:  tidb-lightning pre-check failed. Please fix the failed check(s) or set --check-requirements=false to skip checks

@glorv
Copy link
Collaborator

glorv commented Jul 28, 2022

@jansu-dev Good job!

As we have migrate the br repo into tidb for a while, please move the logic in this PR at
https://github.com/pingcap/tidb/blob/678bbeefd088bbeebeafcc27fe5592ceaafb8404/br/pkg/lightning/restore/restore.go#L1968

@AricSu
Copy link
Author

AricSu commented Jul 28, 2022

@jansu-dev Good job!

As we have migrate the br repo into tidb for a while, please move the logic in this PR at https://github.com/pingcap/tidb/blob/678bbeefd088bbeebeafcc27fe5592ceaafb8404/br/pkg/lightning/restore/restore.go#L1968

thanks for your reply. and i have moved it to tidb repo. -->pingcap/tidb#36672

@AricSu
Copy link
Author

AricSu commented Jul 28, 2022

/close

@ti-chi-bot ti-chi-bot closed this Jul 28, 2022
@ti-chi-bot
Copy link
Member

@jansu-dev: Closed this PR.

In response to this:

/close

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lightning imports data to non-destination cluster and leads to index inconsistency with data
3 participants