terrymanu commented on issue #34456:
URL:
https://github.com/apache/shardingsphere/issues/34456#issuecomment-3535559084
In your ShardingSphere configuration:
```yaml
tables:
table_one:
actualDataNodes: ds${0..1}.table_one
table_one: # ❌ Duplicate table name definition!
actualDataNodes: ds${0..1}.table_twp # Different target table
```
This violates ShardingSphere's basic configuration rules:
1. Key Uniqueness: Each logical table name must be unique in YAML
configuration
2. Configuration Override: The latter table_one definition overrides the
previous one, causing metadata resolution confusion
3. Routing Conflict: ShardingSphere cannot determine which actualDataNodes
configuration to use
## Correct Configuration Approaches
Option 1: Combined Definition (Recommended)
tables:
table_one:
actualDataNodes: ds${0..1}.table_one, ds${0..1}.table_two
Option 2: Use Different Logical Table Names
tables:
table_one:
actualDataNodes: ds${0..1}.table_one
table_two:
actualDataNodes: ds${0..1}.table_two
## Regarding Your Solution
You resolved the issue by adding @Table(schema = "schema_poc", name =
"table_one"). This works because the explicit schema information helped
ShardingSphere bypass the configuration error. However, I recommend fixing the
configuration file instead of relying on entity annotations to work around
the problem.
## Recommendations
1. Fix Configuration File: Remove duplicate table name definitions
2. Follow Configuration Standards: Ensure each logical table name is
unique in the configuration
3. Validate Configuration: Use ShardingSphere's configuration validation
tools to check configuration correctness
This ensures configuration clarity and maintainability, avoiding potential
routing issues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]