From 720f93bb4d864424608f0cf0a412b84eabe8a779 Mon Sep 17 00:00:00 2001 From: jiangML <1060319118@qq.com> Date: Fri, 1 Nov 2024 12:19:40 +0800 Subject: [PATCH] Update the default value of instance-connection-enabled to true --- .../props/temporary/TemporaryConfigurationPropertyKey.java | 2 +- .../shardingsphere/mode/metadata/MetaDataContextsFactory.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/temporary/TemporaryConfigurationPropertyKey.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/temporary/TemporaryConfigurationPropertyKey.java index 10c90eb4f8665a..d73cf357381fc2 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/temporary/TemporaryConfigurationPropertyKey.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/temporary/TemporaryConfigurationPropertyKey.java @@ -71,7 +71,7 @@ public enum TemporaryConfigurationPropertyKey implements TypedPropertyKey { * Instance connection enabled. */ @SphereEx - INSTANCE_CONNECTION_ENABLED("instance-connection-enabled", String.valueOf(Boolean.FALSE), boolean.class, false), + INSTANCE_CONNECTION_ENABLED("instance-connection-enabled", String.valueOf(Boolean.TRUE), boolean.class, false), @SphereEx DROP_CURRENT_USER_ENABLED("drop-current-user-enabled", String.valueOf(Boolean.TRUE), boolean.class, false); diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java index 54e2a54980d285..fdcfe96fdf6aed 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java @@ -30,6 +30,7 @@ import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration; import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; +import org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationProperties; import org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationPropertyKey; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.database.core.metadata.database.DialectDatabaseMetaData; @@ -156,8 +157,7 @@ private static MetaDataContexts createByLocal(final MetaDataPersistService persi private static MetaDataContexts createByRepository(final MetaDataPersistService persistService, final ContextManagerBuilderParameter param, final ComputeNodeInstanceContext computeNodeInstanceContext, @SphereEx final Map statusMap) { @SphereEx - boolean isInstanceConnectionEnabled = Boolean.parseBoolean( - String.valueOf(param.getProps().getOrDefault(TemporaryConfigurationPropertyKey.INSTANCE_CONNECTION_ENABLED.getKey(), Boolean.FALSE.toString()))); + boolean isInstanceConnectionEnabled = new TemporaryConfigurationProperties(persistService.getPropsService().load()).getValue(TemporaryConfigurationPropertyKey.INSTANCE_CONNECTION_ENABLED); @SphereEx(Type.MODIFY) Map effectiveDatabaseConfigs = createEffectiveDatabaseConfigurations(getDatabaseNames(persistService), param.getDatabaseConfigs(), persistService, isInstanceConnectionEnabled);