apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.83k stars 6.71k forks source link

drop rule, but rule config in memory not drop #33134

Open dobet opened 1 day ago

dobet commented 1 day ago

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.5.0 etcd

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

proxy cluster

Expected behavior

drop an rule, and the config can recreate

Actual behavior

ERROR 10200 (44000): Invalid 'Readwrite-splitting' rules 'group0', error messages are: [group0] already exists in storage unit

Reason analyze (If you can)

rule config also alive in memory.

I debug the code, but the

public void renew(final DropRuleItemEvent event)

not access.

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

mysql>create readwrite_splitting rule group0 (WRITE_STORAGE_UNIT=ds_0, READ_STORAGE_UNITS(ds_1));

mysql> show readwrite_splitting rules\G
*************************** 1. row ***************************
                             name: group0
          write_storage_unit_name: ds_0
          read_storage_unit_names: ds_1
transactional_read_query_strategy: DYNAMIC
               load_balancer_type: 
              load_balancer_props: 
1 row in set (0.04 sec)

mysql> drop readwrite_splitting rule group0;
Query OK, 0 rows affected (0.01 sec)

mysql> show readwrite_splitting rules\G
Empty set (0.00 sec)

mysql> create readwrite_splitting rule group0 (WRITE_STORAGE_UNIT=ds_0, READ_STORAGE_UNITS(ds_1));
ERROR 10200 (44000): Invalid 'Readwrite-splitting' rules 'group0', error messages are: [group0] already exists in storage unit

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

terrymanu commented 1 day ago

It seems that only ETCD is causing issues, and currently, ZooKeeper is used more frequently. If ZooKeeper cannot be used as a substitute for ETCD, I would like to ask if there are any volunteers willing to investigate this issue?