tidb icon indicating copy to clipboard operation
tidb copied to clipboard

TiDB schema diff is wrong

Open lidezhu opened this issue 2 years ago • 4 comments

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 avatar Sep 14 '22 06:09 lidezhu

Maybe it is a ddl related bug? @jebter

windtalker avatar Sep 16 '22 09:09 windtalker

@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.

bb7133 avatar Sep 17 '22 02:09 bb7133

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 avatar Sep 19 '22 02:09 lidezhu

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

lidezhu avatar Sep 20 '22 02:09 lidezhu

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...

3pointer avatar Oct 20 '22 03:10 3pointer

@lidezhu Can you check if this issue is fixed?

BornChanger avatar Aug 18 '23 07:08 BornChanger

/remove-severity major

BornChanger avatar Sep 08 '23 11:09 BornChanger

/severity minor

BornChanger avatar Sep 08 '23 11:09 BornChanger

@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.

ti-chi-bot[bot] avatar Sep 08 '23 11:09 ti-chi-bot[bot]