pingcap / pingcap/tidb

TiDB schema diff is wrong

Open
#37,804 9 comments 0 reactions 0 assignees View on GitHub
affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 component/br component/tiflash may-affects-6.0 may-affects-6.1 may-affects-6.2 severity/minor type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.