From d4296b8808de2e11849c79713c473a957d88d28e Mon Sep 17 00:00:00 2001 From: Raigor Date: Sun, 24 Mar 2024 22:25:01 +0800 Subject: [PATCH] Refactor ConvertYamlConfigurationExecutor (#30627) --- ...leConfigurationToDistSQLConverterTest.java | 3 +- .../ral/convert/DistSQLScriptConstants.java | 8 +- .../ConvertYamlConfigurationExecutor.java | 88 +++++++++---------- .../resources/expected/convert-encrypt.yaml | 4 +- .../test/resources/expected/convert-mix.yaml | 12 +-- .../expected/convert-readwrite-splitting.yaml | 6 +- .../resources/expected/convert-shadow.yaml | 4 +- .../convert-sharding-auto-tables.yaml | 4 +- .../resources/expected/convert-sharding.yaml | 4 +- 9 files changed, 64 insertions(+), 69 deletions(-) diff --git a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/provider/BroadcastRuleConfigurationToDistSQLConverterTest.java b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/provider/BroadcastRuleConfigurationToDistSQLConverterTest.java index d5bfe7dfed2d8..5ee4fa3418bbd 100644 --- a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/provider/BroadcastRuleConfigurationToDistSQLConverterTest.java +++ b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/provider/BroadcastRuleConfigurationToDistSQLConverterTest.java @@ -33,8 +33,7 @@ class BroadcastRuleConfigurationToDistSQLConverterTest { void assertConvert() { BroadcastRuleConfiguration ruleConfig = mock(BroadcastRuleConfiguration.class); when(ruleConfig.getTables()).thenReturn(Arrays.asList("t_province", "t_city")); - BroadcastRuleConfigurationToDistSQLConverter converter = new BroadcastRuleConfigurationToDistSQLConverter(); - String actual = converter.convert(ruleConfig); + String actual = new BroadcastRuleConfigurationToDistSQLConverter().convert(ruleConfig); assertThat(actual, is("CREATE BROADCAST TABLE RULE t_province,t_city;")); } } diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/ral/convert/DistSQLScriptConstants.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/ral/convert/DistSQLScriptConstants.java index 7acbaa72cad52..1233edbbbee1d 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/ral/convert/DistSQLScriptConstants.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/ral/convert/DistSQLScriptConstants.java @@ -26,10 +26,6 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class DistSQLScriptConstants { - public static final String COMMA = ","; - - public static final String SEMI = ";"; - public static final String CREATE_DATABASE = "CREATE DATABASE %s;"; public static final String USE_DATABASE = "USE %s;"; @@ -42,7 +38,7 @@ public final class DistSQLScriptConstants { public static final String KEY_PASSWORD = "password"; - public static final String RESOURCE_DEFINITION = " %s (" + public static final String STORAGE_UNIT_DEFINITION = " %s (" + System.lineSeparator() + "URL='%s'," + System.lineSeparator() @@ -54,7 +50,7 @@ public final class DistSQLScriptConstants { + System.lineSeparator() + ")"; - public static final String RESOURCE_DEFINITION_WITHOUT_PASSWORD = " %s (" + public static final String STORAGE_UNIT_DEFINITION_WITHOUT_PASSWORD = " %s (" + System.lineSeparator() + "URL='%s'," + System.lineSeparator() diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java index 539b58d15d14d..59ec8eebbf9a4 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java @@ -74,94 +74,94 @@ public Collection getRows(final ConvertYamlConfiguratio } Preconditions.checkNotNull(yamlConfig, "Invalid yaml file `%s`", file.getName()); Preconditions.checkNotNull(yamlConfig.getDatabaseName(), "`databaseName` in file `%s` is required.", file.getName()); - return Collections.singleton(new LocalDataQueryResultRow(generateDistSQL(yamlConfig))); + return Collections.singleton(new LocalDataQueryResultRow(convertYamlConfigToDistSQL(yamlConfig))); } @SuppressWarnings("unchecked") - private String generateDistSQL(final YamlProxyDatabaseConfiguration yamlConfig) { + private String convertYamlConfigToDistSQL(final YamlProxyDatabaseConfiguration yamlConfig) { StringBuilder result = new StringBuilder(); - appendResourceDistSQL(yamlConfig, result); - for (RuleConfiguration each : swapToRuleConfigs(yamlConfig).values()) { - result.append(TypedSPILoader.getService(RuleConfigurationToDistSQLConverter.class, each.getClass()).convert(each)); + result.append(convertDatabase(yamlConfig.getDatabaseName())); + if (!yamlConfig.getDataSources().isEmpty()) { result.append(System.lineSeparator()).append(System.lineSeparator()); + result.append(convertDataSources(yamlConfig.getDataSources())); } - return result.toString(); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private Map swapToRuleConfigs(final YamlProxyDatabaseConfiguration yamlConfig) { - Map result = new TreeMap<>(Comparator.reverseOrder()); - for (YamlRuleConfiguration each : yamlConfig.getRules()) { - YamlRuleConfigurationSwapper swapper = OrderedSPILoader.getServicesByClass(YamlRuleConfigurationSwapper.class, Collections.singleton(each.getRuleConfigurationType())) - .get(each.getRuleConfigurationType()); - result.put(swapper.getOrder(), (RuleConfiguration) swapper.swapToObject(each)); + if (!yamlConfig.getRules().isEmpty()) { + result.append(System.lineSeparator()).append(System.lineSeparator()); + for (RuleConfiguration each : swapToRuleConfigs(yamlConfig).values()) { + result.append(TypedSPILoader.getService(RuleConfigurationToDistSQLConverter.class, each.getClass()).convert(each)); + result.append(System.lineSeparator()).append(System.lineSeparator()); + } } - return result; - } - - private void appendResourceDistSQL(final YamlProxyDatabaseConfiguration yamlConfig, final StringBuilder stringBuilder) { - appendDatabase(yamlConfig.getDatabaseName(), stringBuilder); - appendResources(yamlConfig.getDataSources(), stringBuilder); + return result.toString(); } - private void appendDatabase(final String databaseName, final StringBuilder stringBuilder) { - stringBuilder.append(String.format(DistSQLScriptConstants.CREATE_DATABASE, databaseName)).append(System.lineSeparator()) - .append(String.format(DistSQLScriptConstants.USE_DATABASE, databaseName)).append(System.lineSeparator()).append(System.lineSeparator()); + private String convertDatabase(final String databaseName) { + return String.format(DistSQLScriptConstants.CREATE_DATABASE, databaseName) + System.lineSeparator() + String.format(DistSQLScriptConstants.USE_DATABASE, databaseName); } - private void appendResources(final Map dataSources, final StringBuilder stringBuilder) { - if (dataSources.isEmpty()) { - return; - } - stringBuilder.append(DistSQLScriptConstants.REGISTER_STORAGE_UNIT); + private String convertDataSources(final Map dataSources) { + StringBuilder result = new StringBuilder(DistSQLScriptConstants.REGISTER_STORAGE_UNIT); Iterator> iterator = dataSources.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = iterator.next(); DataSourceConfiguration dataSourceConfig = dataSourceConfigSwapper.swap(entry.getValue()); DataSourcePoolProperties props = DataSourcePoolPropertiesCreator.create(dataSourceConfig); - appendResource(entry.getKey(), props, stringBuilder); + result.append(convertDataSource(entry.getKey(), props)); if (iterator.hasNext()) { - stringBuilder.append(DistSQLScriptConstants.COMMA); + result.append(","); } } - stringBuilder.append(DistSQLScriptConstants.SEMI).append(System.lineSeparator()).append(System.lineSeparator()); + result.append(";"); + return result.toString(); } - private void appendResource(final String resourceName, final DataSourcePoolProperties dataSourcePoolProps, final StringBuilder stringBuilder) { + private String convertDataSource(final String resourceName, final DataSourcePoolProperties dataSourcePoolProps) { Map connectionProps = dataSourcePoolProps.getConnectionPropertySynonyms().getStandardProperties(); String url = (String) connectionProps.get(DistSQLScriptConstants.KEY_URL); String username = (String) connectionProps.get(DistSQLScriptConstants.KEY_USERNAME); String password = (String) connectionProps.get(DistSQLScriptConstants.KEY_PASSWORD); - String props = getResourceProperties(dataSourcePoolProps.getPoolPropertySynonyms(), dataSourcePoolProps.getCustomProperties()); + String props = getDataSourcePoolProps(dataSourcePoolProps.getPoolPropertySynonyms(), dataSourcePoolProps.getCustomProperties()); if (Strings.isNullOrEmpty(password)) { - stringBuilder.append(String.format(DistSQLScriptConstants.RESOURCE_DEFINITION_WITHOUT_PASSWORD, resourceName, url, username, props)); - } else { - stringBuilder.append(String.format(DistSQLScriptConstants.RESOURCE_DEFINITION, resourceName, url, username, password, props)); + return String.format(DistSQLScriptConstants.STORAGE_UNIT_DEFINITION_WITHOUT_PASSWORD, resourceName, url, username, props); } + return String.format(DistSQLScriptConstants.STORAGE_UNIT_DEFINITION, resourceName, url, username, password, props); } - private String getResourceProperties(final PoolPropertySynonyms poolPropertySynonyms, final CustomDataSourcePoolProperties customDataSourcePoolProps) { + private String getDataSourcePoolProps(final PoolPropertySynonyms poolPropertySynonyms, final CustomDataSourcePoolProperties customDataSourcePoolProps) { StringBuilder result = new StringBuilder(); - appendProperties(poolPropertySynonyms.getStandardProperties(), result); + result.append(getDataSourcePoolProps(poolPropertySynonyms.getStandardProperties())); if (!customDataSourcePoolProps.getProperties().isEmpty()) { - result.append(DistSQLScriptConstants.COMMA); - appendProperties(customDataSourcePoolProps.getProperties(), result); + result.append(","); + result.append(getDataSourcePoolProps(customDataSourcePoolProps.getProperties())); } return result.toString(); } - private void appendProperties(final Map props, final StringBuilder stringBuilder) { + private String getDataSourcePoolProps(final Map props) { + StringBuilder result = new StringBuilder(); Iterator> iterator = props.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = iterator.next(); if (null == entry.getValue()) { continue; } - stringBuilder.append(String.format(DistSQLScriptConstants.PROPERTY, entry.getKey(), entry.getValue())); + result.append(String.format(DistSQLScriptConstants.PROPERTY, entry.getKey(), entry.getValue())); if (iterator.hasNext()) { - stringBuilder.append(DistSQLScriptConstants.COMMA).append(' '); + result.append(","); } } + return result.toString(); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private Map swapToRuleConfigs(final YamlProxyDatabaseConfiguration yamlConfig) { + Map result = new TreeMap<>(Comparator.reverseOrder()); + for (YamlRuleConfiguration each : yamlConfig.getRules()) { + YamlRuleConfigurationSwapper swapper = OrderedSPILoader.getServicesByClass(YamlRuleConfigurationSwapper.class, Collections.singleton(each.getRuleConfigurationType())) + .get(each.getRuleConfigurationType()); + result.put(swapper.getOrder(), (RuleConfiguration) swapper.swapToObject(each)); + } + return result; } @Override diff --git a/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml b/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml index 9a7676ae0ee57..87054a9a4c652 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml @@ -21,12 +21,12 @@ REGISTER STORAGE UNIT ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_encrypt_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_1 ( URL='jdbc:mysql://127.0.0.1:3306/demo_encrypt_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE ENCRYPT RULE t_encrypt ( diff --git a/proxy/backend/core/src/test/resources/expected/convert-mix.yaml b/proxy/backend/core/src/test/resources/expected/convert-mix.yaml index 05ee119566606..444c84007b832 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-mix.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-mix.yaml @@ -21,32 +21,32 @@ REGISTER STORAGE UNIT ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_1 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_2 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_2?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_3 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_3?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_4 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_4?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_5 ( URL='jdbc:mysql://127.0.0.1:3306/demo_ds_5?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE READWRITE_SPLITTING RULE readwrite_ds_0 ( diff --git a/proxy/backend/core/src/test/resources/expected/convert-readwrite-splitting.yaml b/proxy/backend/core/src/test/resources/expected/convert-readwrite-splitting.yaml index 415f211ff1ce4..fb1e84f16bc24 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-readwrite-splitting.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-readwrite-splitting.yaml @@ -21,17 +21,17 @@ REGISTER STORAGE UNIT write_ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_write_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), read_ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_read_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), read_ds_1 ( URL='jdbc:mysql://127.0.0.1:3306/demo_read_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE READWRITE_SPLITTING RULE readwrite_ds ( diff --git a/proxy/backend/core/src/test/resources/expected/convert-shadow.yaml b/proxy/backend/core/src/test/resources/expected/convert-shadow.yaml index 563559443deea..3f4a835a98716 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-shadow.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-shadow.yaml @@ -21,12 +21,12 @@ REGISTER STORAGE UNIT ds ( URL='jdbc:mysql://127.0.0.1:3306/demo_shadow_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), shadow_ds ( URL='jdbc:mysql://127.0.0.1:3306/demo_shadow_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE SHADOW RULE shadowDataSource( diff --git a/proxy/backend/core/src/test/resources/expected/convert-sharding-auto-tables.yaml b/proxy/backend/core/src/test/resources/expected/convert-sharding-auto-tables.yaml index 198077d7df6a7..c3761fb8184ce 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-sharding-auto-tables.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-sharding-auto-tables.yaml @@ -21,12 +21,12 @@ REGISTER STORAGE UNIT ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_1 ( URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE SHARDING TABLE RULE t_order ( diff --git a/proxy/backend/core/src/test/resources/expected/convert-sharding.yaml b/proxy/backend/core/src/test/resources/expected/convert-sharding.yaml index 9acaf3d4eb38c..ad056ada899e8 100644 --- a/proxy/backend/core/src/test/resources/expected/convert-sharding.yaml +++ b/proxy/backend/core/src/test/resources/expected/convert-sharding.yaml @@ -21,12 +21,12 @@ REGISTER STORAGE UNIT ds_0 ( URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_0?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ), ds_1 ( URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_1?useSSL=false', USER='root', PASSWORD='12345678', -PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50') +PROPERTIES('minPoolSize'='1','connectionTimeoutMilliseconds'='30000','maxLifetimeMilliseconds'='1800000','idleTimeoutMilliseconds'='60000','maxPoolSize'='50') ); CREATE SHARDING TABLE RULE t_order (