RaigorJiang opened a new issue #14609: URL: https://github.com/apache/shardingsphere/issues/14609
Hi community, ### Background Now, when there are unused sharding algorithms in the metadata, users can use DistSQL to drop them. For example: 1. User created a sharding algorithm, but never created a SHARDING TABLE RULE to use it; 2. User dropped the SHARDING TABLE RULE which using a algorithm, but did not drop the corresponding algorithm; At the same time, users can view all sharding algorithms through `SHOW SHARDING ALGORITHMS,` but they do not know which algorithms are not in used when viewing them. ### Aim Therefore, I suggest adding a new syntax to help users quickly find algorithms that can be cleaned up and improve the efficiency of operation and maintenance. The syntax is as follows: ```sql SHOW UNUSED SHARDING ALGORITHMS [FROM schemaName] ``` ### How to 1. Refer to `ShardingAlgorithmQueryResultSet` to get all the sharding algorithms `algorithms`; 2. Traverse all `ShardingTableRuleConfiguration` and `ShardingAutoTableRuleConfiguration`, parse out the name of the algorithms being used, and remove them from `algorithms`; 3. return `algorithms`, which is the collection of unused sharding algorithms. -- 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]
