This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 ca862cb2ab3 Remove CDC rule, move CDC config into server properties
(#24218)
ca862cb2ab3 is described below
commit ca862cb2ab35b76c495852e39808556d817b9334
Author: Xinze Guo <[email protected]>
AuthorDate: Mon Feb 20 11:28:06 2023 +0800
Remove CDC rule, move CDC config into server properties (#24218)
* Remove CDC rule, move CDC config into server properties,
* Fix ci error
* Reset default value
* Fix ConfigurationPropertiesTest
* ignored InterruptedException
---
.../config/props/ConfigurationPropertyKey.java | 7 ++-
.../config/props/ConfigurationPropertiesTest.java | 5 +-
.../data/pipeline/cdc/constant/CDCOrder.java | 29 -----------
.../data/pipeline/cdc/rule/CDCRule.java | 46 -----------------
.../pipeline/cdc/rule/builder/CDCRuleBuilder.java | 48 ------------------
.../cdc/yaml/config/YamlCDCRuleConfiguration.java | 41 ----------------
.../swapper/YamlCDCRuleConfigurationSwapper.java | 57 ----------------------
...ere.infra.rule.builder.global.GlobalRuleBuilder | 18 -------
...onfig.swapper.rule.YamlRuleConfigurationSwapper | 18 -------
.../backend/config/ProxyConfigurationLoader.java | 3 --
.../config/yaml/YamlProxyServerConfiguration.java | 3 --
.../config/ProxyConfigurationLoaderTest.java | 1 -
.../queryable/ShowDistVariablesExecutorTest.java | 2 +-
.../org/apache/shardingsphere/proxy/Bootstrap.java | 7 ++-
.../bootstrap/src/main/resources/conf/server.yaml | 5 +-
.../shardingsphere/proxy/frontend/CDCServer.java | 3 +-
.../dataset/empty_rules/show_dist_variables.xml | 1 +
17 files changed, 17 insertions(+), 277 deletions(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
index e23ebbb7ae6..5784dcf38aa 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
@@ -122,7 +122,12 @@ public enum ConfigurationPropertyKey implements
TypedPropertyKey {
/**
* Proxy instance type.
*/
- PROXY_INSTANCE_TYPE("proxy-instance-type", "Proxy", String.class, true);
+ PROXY_INSTANCE_TYPE("proxy-instance-type", "Proxy", String.class, true),
+
+ /**
+ * CDC server port.
+ */
+ CDC_SERVER_PORT("cdc-server-port", "33071", int.class, true);
private final String key;
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
index 1f19ab5f1bf..797255163a6 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
@@ -50,6 +50,7 @@ public final class ConfigurationPropertiesTest {
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION),
is("5.7.22"));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT),
is(3308));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_NETTY_BACKLOG),
is(1024));
+ assertThat(actual.getValue(ConfigurationPropertyKey.CDC_SERVER_PORT),
is(33071));
}
private Properties createProperties() {
@@ -70,7 +71,8 @@ public final class ConfigurationPropertiesTest {
new
Property(ConfigurationPropertyKey.PROXY_FRONTEND_MAX_CONNECTIONS.getKey(),
"20"),
new
Property(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION.getKey(),
"5.7.22"),
new
Property(ConfigurationPropertyKey.PROXY_DEFAULT_PORT.getKey(), "3308"),
- new
Property(ConfigurationPropertyKey.PROXY_NETTY_BACKLOG.getKey(), "1024"));
+ new
Property(ConfigurationPropertyKey.PROXY_NETTY_BACKLOG.getKey(), "1024"),
+ new
Property(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey(), "33071"));
}
@Test
@@ -93,5 +95,6 @@ public final class ConfigurationPropertiesTest {
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION),
is("5.7.22"));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT),
is(3307));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_NETTY_BACKLOG),
is(1024));
+ assertThat(actual.getValue(ConfigurationPropertyKey.CDC_SERVER_PORT),
is(33071));
}
}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/constant/CDCOrder.java
b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/constant/CDCOrder.java
deleted file mode 100644
index 7ea9fccaf21..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/constant/CDCOrder.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.cdc.constant;
-
-/**
- * CDC rule order.
- */
-public final class CDCOrder {
-
- /**
- * CDC order.
- */
- public static final int ORDER = 10000;
-}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/CDCRule.java
b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/CDCRule.java
deleted file mode 100644
index 2f2b21df21f..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/CDCRule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.cdc.rule;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.data.pipeline.cdc.config.CDCRuleConfiguration;
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.rule.identifier.scope.GlobalRule;
-
-/**
- * CDC rule.
- */
-@RequiredArgsConstructor
-@Getter
-public final class CDCRule implements GlobalRule {
-
- private final boolean enable;
-
- private final int port;
-
- @Override
- public RuleConfiguration getConfiguration() {
- return new CDCRuleConfiguration(enable, port);
- }
-
- @Override
- public String getType() {
- return CDCRule.class.getSimpleName();
- }
-}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/builder/CDCRuleBuilder.java
b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/builder/CDCRuleBuilder.java
deleted file mode 100644
index a6325ae0534..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/rule/builder/CDCRuleBuilder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.cdc.rule.builder;
-
-import org.apache.shardingsphere.data.pipeline.cdc.config.CDCRuleConfiguration;
-import org.apache.shardingsphere.data.pipeline.cdc.constant.CDCOrder;
-import org.apache.shardingsphere.data.pipeline.cdc.rule.CDCRule;
-import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder;
-
-import java.util.Map;
-
-/**
- * CDC rule builder.
- */
-public final class CDCRuleBuilder implements
GlobalRuleBuilder<CDCRuleConfiguration> {
-
- @Override
- public CDCRule build(final CDCRuleConfiguration ruleConfig, final
Map<String, ShardingSphereDatabase> databases, final ConfigurationProperties
props) {
- return new CDCRule(ruleConfig.isEnabled(), ruleConfig.getPort());
- }
-
- @Override
- public int getOrder() {
- return CDCOrder.ORDER;
- }
-
- @Override
- public Class<CDCRuleConfiguration> getTypeClass() {
- return CDCRuleConfiguration.class;
- }
-}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/config/YamlCDCRuleConfiguration.java
b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/config/YamlCDCRuleConfiguration.java
deleted file mode 100644
index 7768ee61a98..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/config/YamlCDCRuleConfiguration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.cdc.yaml.config;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.data.pipeline.cdc.config.CDCRuleConfiguration;
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-
-/**
- * CDC configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlCDCRuleConfiguration implements YamlRuleConfiguration {
-
- private boolean enabled;
-
- private int port = 33071;
-
- @Override
- public Class<? extends RuleConfiguration> getRuleConfigurationType() {
- return CDCRuleConfiguration.class;
- }
-}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/swapper/YamlCDCRuleConfigurationSwapper.java
b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/swapper/YamlCDCRuleConfigurationSwapper.java
deleted file mode 100644
index 7ef181271bf..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/yaml/swapper/YamlCDCRuleConfigurationSwapper.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.cdc.yaml.swapper;
-
-import org.apache.shardingsphere.data.pipeline.cdc.config.CDCRuleConfiguration;
-import org.apache.shardingsphere.data.pipeline.cdc.constant.CDCOrder;
-import
org.apache.shardingsphere.data.pipeline.cdc.yaml.config.YamlCDCRuleConfiguration;
-import
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
-
-/**
- * YAML CDC rule configuration swapper.
- */
-public final class YamlCDCRuleConfigurationSwapper implements
YamlRuleConfigurationSwapper<YamlCDCRuleConfiguration, CDCRuleConfiguration> {
-
- @Override
- public YamlCDCRuleConfiguration swapToYamlConfiguration(final
CDCRuleConfiguration data) {
- YamlCDCRuleConfiguration result = new YamlCDCRuleConfiguration();
- result.setPort(null == data ? 33071 : data.getPort());
- result.setEnabled(null != data && data.isEnabled());
- return result;
- }
-
- @Override
- public CDCRuleConfiguration swapToObject(final YamlCDCRuleConfiguration
yamlConfig) {
- return new CDCRuleConfiguration(yamlConfig.isEnabled(),
yamlConfig.getPort());
- }
-
- @Override
- public Class<CDCRuleConfiguration> getTypeClass() {
- return CDCRuleConfiguration.class;
- }
-
- @Override
- public String getRuleTagName() {
- return "CDC";
- }
-
- @Override
- public int getOrder() {
- return CDCOrder.ORDER;
- }
-}
diff --git
a/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder
b/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder
deleted file mode 100644
index 8bf328f3517..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.data.pipeline.cdc.rule.builder.CDCRuleBuilder
diff --git
a/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
b/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
deleted file mode 100644
index 526ecb96c8c..00000000000
---
a/kernel/data-pipeline/cdc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.data.pipeline.cdc.yaml.swapper.YamlCDCRuleConfigurationSwapper
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
index b3ff26880c2..357e137245b 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
@@ -97,9 +97,6 @@ public final class ProxyConfigurationLoader {
if (null != serverConfiguration.getTraffic()) {
serverConfiguration.getRules().add(serverConfiguration.getTraffic());
}
- if (null != serverConfiguration.getCdc()) {
- serverConfiguration.getRules().add(serverConfiguration.getCdc());
- }
if (null != serverConfiguration.getLogging()) {
serverConfiguration.getRules().add(serverConfiguration.getLogging());
}
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
index de78031cc40..81155e2045f 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.proxy.backend.config.yaml;
import lombok.Getter;
import lombok.Setter;
import
org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration;
-import
org.apache.shardingsphere.data.pipeline.cdc.yaml.config.YamlCDCRuleConfiguration;
import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
@@ -53,8 +52,6 @@ public final class YamlProxyServerConfiguration implements
YamlConfiguration {
private YamlTrafficRuleConfiguration traffic;
- private YamlCDCRuleConfiguration cdc;
-
private YamlLoggingRuleConfiguration logging;
private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
index 2f77b9aa5fb..6f1d50ac23a 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
@@ -48,7 +48,6 @@ public final class ProxyConfigurationLoaderTest {
YamlProxyServerConfiguration serverConfig =
actual.getServerConfiguration();
assertNull(serverConfig.getMode());
assertNull(serverConfig.getAuthority());
- assertNull(serverConfig.getCdc());
assertNull(serverConfig.getLabels());
assertTrue(serverConfig.getProps().isEmpty());
assertTrue(serverConfig.getRules().isEmpty());
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
index 9702d75ec8a..2f2a788b64e 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
@@ -65,7 +65,7 @@ public final class ShowDistVariablesExecutorTest extends
ProxyContextRestorer {
when(metaData.getGlobalRuleMetaData()).thenReturn(new
ShardingSphereRuleMetaData(Collections.singleton(new LoggingRule(new
DefaultLoggingRuleConfigurationBuilder().build()))));
ShowDistVariablesExecutor executor = new ShowDistVariablesExecutor();
Collection<LocalDataQueryResultRow> actual =
executor.getRows(metaData, connectionSession,
mock(ShowDistVariablesStatement.class));
- assertThat(actual.size(), is(22));
+ assertThat(actual.size(), is(23));
LocalDataQueryResultRow row = actual.iterator().next();
assertThat(row.getCell(1), is("system_log_level"));
assertThat(row.getCell(2), is("INFO"));
diff --git
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 483de595dae..a56626aac6b 100644
---
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -31,6 +31,7 @@ import
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
+import java.util.Optional;
/**
* ShardingSphere-Proxy Bootstrap.
@@ -51,10 +52,8 @@ public final class Bootstrap {
int port = bootstrapArgs.getPort().orElseGet(() -> new
ConfigurationProperties(yamlConfig.getServerConfiguration().getProps()).getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT));
List<String> addresses = bootstrapArgs.getAddresses();
new BootstrapInitializer().init(yamlConfig, port,
bootstrapArgs.getForce());
- boolean cdcEnabled = null !=
yamlConfig.getServerConfiguration().getCdc() &&
yamlConfig.getServerConfiguration().getCdc().isEnabled();
- if (cdcEnabled) {
- new CDCServer(addresses,
yamlConfig.getServerConfiguration().getCdc().getPort()).start();
- }
+ Optional.ofNullable((Integer)
yamlConfig.getServerConfiguration().getProps().get(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey()))
+ .ifPresent(cdcPort -> new CDCServer(addresses,
cdcPort).start());
new ShardingSphereProxy().start(port, addresses);
}
}
diff --git a/proxy/bootstrap/src/main/resources/conf/server.yaml
b/proxy/bootstrap/src/main/resources/conf/server.yaml
index 44ea4e14614..a8574979a05 100644
--- a/proxy/bootstrap/src/main/resources/conf/server.yaml
+++ b/proxy/bootstrap/src/main/resources/conf/server.yaml
@@ -55,10 +55,6 @@
# initialCapacity: 128
# maximumSize: 1024
#
-#cdc:
-# enabled: false
-# port: 33071
-#
#logging:
# loggers:
# - loggerName: ShardingSphere-SQL
@@ -89,3 +85,4 @@
# proxy-mysql-default-version: 5.7.22 # In the absence of schema name, the
default version will be used.
# proxy-default-port: 3307 # Proxy default port.
# proxy-netty-backlog: 1024 # Proxy netty backlog.
+# cdc-server-port: 33071 # CDC server port
diff --git
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/CDCServer.java
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/CDCServer.java
index 953de6168e4..342febb70b9 100644
---
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/CDCServer.java
+++
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/CDCServer.java
@@ -31,7 +31,6 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.proxy.frontend.netty.CDCServerHandlerInitializer;
@@ -54,13 +53,13 @@ public final class CDCServer extends Thread {
private EventLoopGroup workerGroup;
@Override
- @SneakyThrows(InterruptedException.class)
public void run() {
try {
List<ChannelFuture> futures = startInternal(addressed, port);
for (ChannelFuture each : futures) {
each.channel().closeFuture().sync();
}
+ } catch (final InterruptedException ignored) {
} finally {
close();
}
diff --git
a/test/e2e/suite/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
b/test/e2e/suite/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
index b7e369f9440..f60335ff415 100644
---
a/test/e2e/suite/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
+++
b/test/e2e/suite/src/test/resources/cases/ral/dataset/empty_rules/show_dist_variables.xml
@@ -36,6 +36,7 @@
<row values="proxy_default_port| 3307" />
<row values="proxy_netty_backlog| 1024" />
<row values="proxy_instance_type| Proxy" />
+ <row values="cdc_server_port| 33071" />
<row values="proxy_meta_data_collector_enabled| true" />
<row values="agent_plugins_enabled| true" />
<row values="cached_connections| 0" />