thswlsqls opened a new issue, #39870:
URL: https://github.com/apache/shardingsphere/issues/39870

   # DISABLE_AUDIT_NAMES hint is ignored when the auditor name contains 
upper-case letters
   
   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master @ 101c3d56ccd
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Both
   
   ### Expected behavior
   With `allowHintDisable: true`, `/* SHARDINGSPHERE_HINT: 
DISABLE_AUDIT_NAMES=<name> */` skips the named auditor.
   
   ### Actual behavior
   When the auditor name contains an upper-case letter (e.g. 
`shardingKeyAuditor`), the hint is ignored even with identical spelling; the 
auditor still runs and throws `DMLWithoutShardingKeyException`.
   
   ### Reason analyze (If you can)
   `ShardingSQLAuditor.audit()` 
(`features/sharding/core/.../auditor/ShardingSQLAuditor.java` line 53) 
evaluates `disableAuditNames.contains(each.toLowerCase())`: the configured name 
is lower-cased while the hint value is kept as written (`SQLHintUtils` only 
trims).
   The next line resolves `rule.getAuditors().get(each)` through a 
`CaseInsensitiveMap` (`ShardingRule` line 99), so one method applies two case 
rules.
   DistSQL lower-cases auditor names; this reproduces with YAML or Java API 
configuration.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1. Configure `auditors: { shardingKeyAuditor: { type: 
DML_SHARDING_CONDITIONS } }` and `auditStrategy: { auditorNames: 
[shardingKeyAuditor], allowHintDisable: true }`.
   2. Execute `/* SHARDINGSPHERE_HINT: DISABLE_AUDIT_NAMES=shardingKeyAuditor 
*/ SELECT * FROM t_order;`.
   3. `DMLWithoutShardingKeyException` is thrown.
   
   ### Example codes for reproduce this issue (such as a github link).
   N/A
   
   


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

Reply via email to