apache / apache/shardingsphere
Can not get uniformed table structure for logic table `Can not get uniformed table structure for logic table `normal_record`, it has different meta data of actual tables are as follows`, it has different meta data of actual tables are as follows
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 326
Description
## Bug Report
### Which version of ShardingSphere did you use?
5.4.1
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
the simple table should not appear InconsistentShardingTableMetaDataException
### Actual behavior
Caused by: org.apache.shardingsphere.sharding.exception.metadata.InconsistentShardingTableMetaDataException: Can not get uniformed table structure for logic table `normal_record`, it has different meta data of actual tables are as follows:
actual table: normal_record, meta data: TableMetaData(name=normal_record, columns=[ColumnMetaData(name=id, dataType=-5, primaryKey=true, generated=true, caseSensitive=true, visible=true, unsigned=false, nullable=false), ColumnMetaData(name=description, dataType=12, primaryKey=false, generated=false, caseSensitive=true, visible=true, unsigned=false, nullable=true)], indexes=[IndexMetaData(name=normal_record_pkey, columns=[id], unique=true)], constraints=[])
actual table: normal_record, meta data: TableMetaData(name=normal_record, columns=[ColumnMetaData(name=id, dataType=-5, primaryKey=true, generated=true, caseSensitive=true, visible=true, unsigned=false, nullable=false), ColumnMetaData(name=description, dataType=12, primaryKey=false, generated=false, caseSensitive=true, visible=true, unsigned=false, nullable=true)], indexes=[IndexMetaData(name=normal_record_pkey, columns=[id], unique=true)], constraints=[])

### Reason analyze (If you can)
In TableMetaData definition,the field ’indexes‘ is Collection; In the running, the collection type is AbstractMapBasedMultimap.WrappedSet for the field 'indexes' and 'constraints' , In WrappedSet , equal and hashset is not suitable for this scene.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
in sharding database,use the same datasource to config,and set CHECK_TABLE_METADATA_ENABLED true
### Example codes for reproduce this issue (such as a github link).
Contributor guide
Research direction
Start with the TableMetaData definition, focusing on the indexes and constraints collections and their WrappedSet equality behavior. Reproduce the ShardingSphere-JDBC case with the same datasource and CHECK_TABLE_METADATA_ENABLED set to true; done means identical actual tables no longer trigger InconsistentShardingTableMetaDataException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100