terrymanu commented on issue #37081:
URL:
https://github.com/apache/shardingsphere/issues/37081#issuecomment-3524926709
I have carefully analyzed the issue you reported. According to your
description, ShardingSphere 5.3.2 encounters an error at the
ShadowSQLRouter#decorateRouteContext step when using a combination of sharding
rules and
shadow rules.
Current Understanding
Your configuration includes:
- Data sources: db_0, db_1 (production) and shadow_0, shadow_1 (shadow)
- Sharding rules: Database sharding based on user_id, table sharding based
on order_no
- Shadow rules: db_1 mapped to shadow_1, using VALUE_MATCH algorithm to
match user_id='x3'
The sharding rule works correctly, but it fails at the shadow rule
processing step.
More Information Needed
To accurately identify the root cause, please provide the following
information:
1. Complete error stack trace
- Currently only showing method call chain, need specific exception
information and complete stack trace
- Please include exception type and error message
2. Actual executed SQL statement and parameters
- Complete SQL statement
- Parameter binding values (especially the actual value of user_id)
3. Simplified reproduction code
- Minimal test code
- Remove unnecessary business logic
4. Log configuration
- Please confirm ShardingSphere SQL logging is enabled (you have
configured sql-show: true)
- Provide complete log output during execution
Possible Cause Analysis
Based on code analysis, the issue might occur in:
1. Data source mapping logic
- ShadowSQLRouter needs to correctly identify whether the sharded data
source is a shadow data source
- Check the return value of findProductionDataSourceName method
2. Shadow algorithm matching
- VALUE_MATCH algorithm needs to correctly obtain SQL parameters
- Check if user_id parameter passing is correct
3. Configuration consistency
- Ensure data source names in shadow rules match actual data source
names produced by sharding rules
Recommended Check Steps
1. Verify shadow algorithm configuration
shadowAlgorithms:
user_id_value:
type: VALUE_MATCH
props:
operation: select # Ensure it matches actual SQL type
column: user_id
value: x3
2. Check data source mapping
- Confirm shadowDataSource1 configuration is correct
- Verify productionDataSourceName: db_1 is consistent with sharding
results
3. Enable detailed logging
props:
sql-show: true
sql-simple: true
Please provide the above information, which will help us accurately
identify the issue and provide a solution. If this is a ShardingSphere bug, we
will fix it based on the specific situation.
--
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]