DROP SHARDING TABLE RULE reports success but keeps a rule whose name differs only in case
Bug Report
Which version of ShardingSphere did you use?
master @ 28ee19118f9
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Both (DistSQL, mainly Proxy)
Expected behavior
DROP SHARDING TABLE RULE T_ORDER removes the configured sharding table rule t_order, because table names are matched case-insensitively elsewhere.
Actual behavior
The statement returns success, but the t_order rule is not removed.
Reason analyze (If you can)
DropShardingTableRuleExecutor.hasAnyOneToBeDropped() compares logic table names with LinkedList and Collections.disjoint, which is case-sensitive. The existence check (CaseInsensitiveSet) and buildToBeDroppedRuleConfiguration() (equalsIgnoreCase) in the same class ignore case, so the statement passes the checks, then DatabaseRuleDefinitionExecuteEngine sees hasAnyOneToBeDropped() == false and skips the drop. ShardingRule stores tables in a CaseInsensitiveMap. #39200 fixed the same issue for broadcast tables.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
CREATE SHARDING TABLE RULE t_order (...)DROP SHARDING TABLE RULE T_ORDERreturns success.SHOW SHARDING TABLE RULESstill listst_order.
Example codes for reproduce this issue (such as a github link).
N/A
Source: apache/shardingsphere