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

Open
#30,939 3 comments 0 reactions 0 assignees View on GitHub
feature: sharding status: volunteer wanted type: bug
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=[])

![error10](https://github.com/apache/shardingsphere/assets/15098935/a0d27c5c-4b8c-4058-a5d2-78d34a2485d8)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.