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

TiDB schema diff is wrong #37804

Open
lidezhu opened this issue Sep 14, 2022 · 9 comments
Open

TiDB schema diff is wrong #37804

lidezhu opened this issue Sep 14, 2022 · 9 comments

Comments

@lidezhu
Copy link
Contributor

lidezhu commented Sep 14, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Load ch-benchmark(warehouse=1500) with tiflash replica using BR;

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

All tables created in tiflash with no error;

3. What did you see instead (Required)

If print schema diff in tiflash log we can see the following two lines:

["SchemaDiff::deserialize:schema diff raw data {\"version\":35,\"type\":60,\"schema_id\":68,\"table_id\":0,\"old_table_id\":0,\"old_schema_id\":0,\"affected_options\":[{\"schema_id\":68,\"table_id\":70,\"old_table_id\":70,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":71,\"old_table_id\":71,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":72,\"old_table_id\":72,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":73,\"old_table_id\":73,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":74,\"old_table_id\":74,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":75,\"old_table_id\":75,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":76,\"old_table_id\":76,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":77,\"old_table_id\":77,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":78,\"old_table_id\":78,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":79,\"old_table_id\":79,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":80,\"old_table_id\":80,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":81,\"old_table_id\":81,\"old_schema_id\":68},{\"schema_id\":68,\"table_id\":82,\"old_table_id\":82,\"old_schema_id\":68}]}"]

["SchemaBuilder:Creating table chbenchmark(68).revenue1(76)"]

type: 60 means this is an action of createTables. But chbenchmark(68).revenue1(76) is a view which should be in a schema diff of type createView. So tiflash try to create a table for the view revenue1 but failed to do that and throw an exception.

4. What is your TiDB version? (Required)

master nightly

@lidezhu lidezhu added the type/bug The issue is confirmed as a bug. label Sep 14, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Sep 15, 2022
@seiya-annie seiya-annie added component/br This issue is related to BR of TiDB. component/tiflash and removed component/tiflash component/br This issue is related to BR of TiDB. may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Sep 15, 2022
@jebter jebter added the sig/execution SIG execution label Sep 16, 2022
@windtalker
Copy link
Contributor

Maybe it is a ddl related bug? @jebter

@jebter jebter added the sig/sql-infra SIG: SQL Infra label Sep 16, 2022
@bb7133
Copy link
Member

bb7133 commented Sep 17, 2022

@lidezhu Could you provide detailed instructions on how to reproduce this? For example, how the data is prepared with ch-benchmark.

More information like the log of TiDB-server & SHOW CREATE TABLE chbenchmark(68).revenue1(76) would be also helpful.

Thanks.

@lidezhu
Copy link
Contributor Author

lidezhu commented Sep 19, 2022

Just use br to restore the data can produce the problem. I think this is just br's problem which put view in create tables diff.

@lidezhu
Copy link
Contributor Author

lidezhu commented Sep 20, 2022

The tag should be component/br, this problem should have nothing to do with tiflash. @jebter

@xiongjiwei xiongjiwei removed the sig/sql-infra SIG: SQL Infra label Sep 21, 2022
@windtalker windtalker added component/br This issue is related to BR of TiDB. and removed sig/execution SIG execution labels Sep 27, 2022
@3pointer
Copy link
Contributor

can we distinguish the view in tiflash side?
ActionType: 60 is only used for br. actually it's means batchCreateTable with tableInfos. include tables/views.
We can change the action name from CreateTables to CreateTableAndViews...

@BornChanger
Copy link
Contributor

@lidezhu Can you check if this issue is fixed?

@BornChanger
Copy link
Contributor

BornChanger commented Sep 8, 2023

/remove-severity major

@BornChanger
Copy link
Contributor

BornChanger commented Sep 8, 2023

/severity minor

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 8, 2023

@BornChanger: The label(s) severity/mionor cannot be applied, because the repository doesn't have them.

In response to this:

/severity mionor

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 ti-community-infra/tichi repository.

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

No branches or pull requests

10 participants