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

Inccorect results of cluster_info/cluster_config memtables #1894

Closed
lonng opened this issue May 16, 2022 · 3 comments · Fixed by #1893
Closed

Inccorect results of cluster_info/cluster_config memtables #1894

lonng opened this issue May 16, 2022 · 3 comments · Fixed by #1893
Assignees
Labels
type/bug Categorizes issue as related to a bug.

Comments

@lonng
Copy link
Contributor

lonng commented May 16, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Start a TiDB cluster via TiUP playground with tagtiup playground -T test
  2. Stop cluster via ctrl+c
  3. Restart the cluster with previous tag tiup playground -T test

2. What did you expect to see? (Required)

mysql> select * from cluster_info;
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| TYPE    | INSTANCE        | STATUS_ADDRESS  | VERSION | GIT_HASH                                 | START_TIME                | UPTIME           | SERVER_ID |
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| tidb    | 127.0.0.1:4000  | 127.0.0.1:10080 | 6.0.0   | 36a9810441ca0e496cbd22064af274b3be771081 | 2022-05-16T08:56:35-07:00 | 7m23.312941s     |         0 |
| pd      | 127.0.0.1:2379  | 127.0.0.1:2379  | 6.0.0   | 71f35735d7f9ff7bfa8057fbd67a039c9ea8cf75 | 2022-05-16T08:56:29-07:00 | 7m29.312943s     |         0 |
| tikv    | 127.0.0.1:20160 | 127.0.0.1:20180 | 6.0.0   | 2b4f7d57af9ca3e21bc07b91a9cfc466ed87734f | 2022-05-16T08:56:33-07:00 | 7m25.312946s     |         0 |
| tiflash | 127.0.0.1:3930  | 127.0.0.1:20292 | 6.0.0   | 25545c452b21a5e545f7d8237364076ed2a057ec | 2022-05-16T08:56:47-07:00 | 7m11.312948s     |         0 |
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+

3. What did you see instead (Required)

mysql> select * from cluster_info;
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| TYPE    | INSTANCE        | STATUS_ADDRESS  | VERSION | GIT_HASH                                 | START_TIME                | UPTIME           | SERVER_ID |
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+
| tidb    | 127.0.0.1:4000  | 127.0.0.1:10080 | 6.0.0   | 36a9810441ca0e496cbd22064af274b3be771081 | 2022-05-15T20:20:29-07:00 | 12h43m29.312934s |         0 |
| tidb    | 127.0.0.1:4000  | 127.0.0.1:10080 | 6.0.0   | 36a9810441ca0e496cbd22064af274b3be771081 | 2022-05-16T08:54:03-07:00 | 9m55.31294s      |         0 |
| tidb    | 127.0.0.1:4000  | 127.0.0.1:10080 | 6.0.0   | 36a9810441ca0e496cbd22064af274b3be771081 | 2022-05-16T08:56:35-07:00 | 7m23.312941s     |         0 |
| pd      | 127.0.0.1:2379  | 127.0.0.1:2379  | 6.0.0   | 71f35735d7f9ff7bfa8057fbd67a039c9ea8cf75 | 2022-05-16T08:56:29-07:00 | 7m29.312943s     |         0 |
| tikv    | 127.0.0.1:20160 | 127.0.0.1:20180 | 6.0.0   | 2b4f7d57af9ca3e21bc07b91a9cfc466ed87734f | 2022-05-16T08:56:33-07:00 | 7m25.312946s     |         0 |
| tiflash | 127.0.0.1:3930  | 127.0.0.1:20292 | 6.0.0   | 25545c452b21a5e545f7d8237364076ed2a057ec | 2022-05-16T08:56:47-07:00 | 7m11.312948s     |         0 |
+---------+-----------------+-----------------+---------+------------------------------------------+---------------------------+------------------+-----------+

4. What is your TiDB version? (Required)

v6.0.0

mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.0.0-dirty
Edition: Community
Git Commit Hash: 36a9810441ca0e496cbd22064af274b3be771081
Git Branch: HEAD
UTC Build Time: 2022-05-16 19:50:17
GoVersion: go1.18.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@lonng lonng added the type/bug Categorizes issue as related to a bug. label May 16, 2022
@lonng
Copy link
Contributor Author

lonng commented May 16, 2022

I debug this issue and I found that we combine ServerInformationPath with the server ID as the etcd key:https://github.com/pingcap/tidb/blob/683ba092b565aa5947da998507550f8da5c406bd/domain/infosync/info.go#L182

And the server ID will be different every bootstrap time.
https://github.com/pingcap/tidb/blob/683ba092b565aa5947da998507550f8da5c406bd/ddl/ddl.go#L309

@lonng
Copy link
Contributor Author

lonng commented May 17, 2022

I try tiup cluster and tidb operator, and i found I cannot reproduce it. It seems that the TiDB has no chance to execute gracefully shutdown while ctrl+c in tiup playground.
@AstroProfundis PTAL

@lonng lonng transferred this issue from pingcap/tidb May 21, 2022
@nexustar
Copy link
Collaborator

fixed on #1893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Categorizes issue as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants