Skip to content

Broadcast DistSQL create and drop executors match table names case-sensitively #39199

Description

@thswlsqls

Bug Report

Which version of ShardingSphere did you use?

master @ 6621687

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

Both

Expected behavior

Broadcast table names are matched case-insensitively (core BroadcastRule.tables is a CaseInsensitiveSet). Creating a broadcast rule for T_ORDER when t_order exists should raise DuplicateRuleException, and dropping T_ORDER should remove t_order.

Actual behavior

The DistSQL create and drop executors compare table names case-sensitively:

  • CREATE: the duplicate check misses T_ORDER vs t_order, no DuplicateRuleException is thrown, and both cases get stored.
  • DROP: the existence check (case-insensitive) passes, but hasAnyOneToBeDropped (case-sensitive) reports nothing to drop, a silent no-op.

Reason analyze (If you can)

CreateBroadcastTableRuleExecutor.getDuplicatedRuleNames() copies rule tables into a case-sensitive HashSet before retainAll. DropBroadcastTableRuleExecutor.hasAnyOneToBeDropped() runs Collections.disjoint on the raw case-sensitive collection. Its own existence check and the sibling DropMaskRuleExecutor already wrap current tables in CaseInsensitiveSet (drop path partially fixed in #30180).

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

  1. CREATE BROADCAST TABLE RULE t_order;
  2. CREATE BROADCAST TABLE RULE T_ORDER;
  3. DROP BROADCAST TABLE RULE T_ORDER;

Example codes for reproduce this issue (such as a github link).

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions