This is an automated email from the ASF dual-hosted git repository. zhangliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push: new 8935a47f88e Refactor DatabaseRulePersistService (#34645) 8935a47f88e is described below commit 8935a47f88e8e31948f585c8c2e6be16747b5c11 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Wed Feb 12 21:29:00 2025 +0800 Refactor DatabaseRulePersistService (#34645) --- .../persist/config/database/DatabaseRulePersistService.java | 7 +++---- .../mode/node/path/metadata/DatabaseRuleMetaDataNodePath.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java index b7d34f33dce..9ecb051c3f9 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java @@ -117,13 +117,12 @@ public final class DatabaseRulePersistService { public Collection<MetaDataVersion> delete(final String databaseName, final Collection<RuleConfiguration> configs) { Collection<MetaDataVersion> result = new LinkedList<>(); for (YamlRuleConfiguration each : yamlRuleConfigurationSwapperEngine.swapToYamlRuleConfigurations(configs)) { - Collection<RepositoryTuple> repositoryTuples = yamlRepositoryTupleSwapperEngine.swapToRepositoryTuples(each); + List<RepositoryTuple> repositoryTuples = new LinkedList<>(yamlRepositoryTupleSwapperEngine.swapToRepositoryTuples(each)); if (repositoryTuples.isEmpty()) { continue; } - List<RepositoryTuple> newRepositoryTuples = new LinkedList<>(repositoryTuples); - Collections.reverse(newRepositoryTuples); - result.addAll(delete(databaseName, Objects.requireNonNull(each.getClass().getAnnotation(RepositoryTupleEntity.class)).value(), newRepositoryTuples)); + Collections.reverse(repositoryTuples); + result.addAll(delete(databaseName, Objects.requireNonNull(each.getClass().getAnnotation(RepositoryTupleEntity.class)).value(), repositoryTuples)); } return result; } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseRuleMetaDataNodePath.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseRuleMetaDataNodePath.java index 174b08a6ac1..1999061f9c4 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseRuleMetaDataNodePath.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseRuleMetaDataNodePath.java @@ -58,7 +58,7 @@ public final class DatabaseRuleMetaDataNodePath { * @param databaseName database name * @param ruleTypeName rule type name * @param ruleItemName rule item name - * @return database rule path without version + * @return database rule path */ public static String getRulePath(final String databaseName, final String ruleTypeName, final String ruleItemName) { return String.join("/", getRulePath(databaseName, ruleTypeName), ruleItemName);