You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/06/03 09:39:28 UTC
[shardingsphere] branch master updated: Add SQLNotificationEvent
(#10637)
This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 acbf570 Add SQLNotificationEvent (#10637)
acbf570 is described below
commit acbf5708186a24387e6fdbf02f0027a9960b4e8c
Author: Liang Zhang <te...@163.com>
AuthorDate: Thu Jun 3 17:38:44 2021 +0800
Add SQLNotificationEvent (#10637)
* Add SQLNotificationEvent
* Fix checkstyle
* Rename DataSourceDroppedSQLNotificationEvent
* Rename DataSourceDroppedSQLNotificationEvent
---
...ionsAlteredEvent.java => SQLNotificationEvent.java} | 18 +++---------------
...t.java => DataSourceAddedSQLNotificationEvent.java} | 6 +++---
...java => DataSourceDroppedSQLNotificationEvent.java} | 11 +++++------
...RuleConfigurationsAlteredSQLNotificationEvent.java} | 5 +++--
.../config/service/impl/DataSourceRegistryService.java | 18 +++++++++++-------
.../config/service/impl/SchemaRuleRegistryService.java | 4 ++--
.../service/impl/DataSourceRegistryServiceTest.java | 9 +++++----
.../service/impl/SchemaRuleRegistryServiceTest.java | 4 ++--
.../distsql/rdl/impl/AddResourceBackendHandler.java | 4 ++--
.../AlterShardingBindingTableRulesBackendHandler.java | 4 ++--
...AlterShardingBroadcastTableRulesBackendHandler.java | 4 ++--
.../rdl/impl/AlterShardingTableRuleBackendHandler.java | 4 ++--
.../CreateDatabaseDiscoveryRuleBackendHandler.java | 5 +++--
.../rdl/impl/CreateEncryptRuleBackendHandler.java | 4 ++--
.../CreateReadwriteSplittingRuleBackendHandler.java | 4 ++--
.../CreateShardingBindingTableRulesBackendHandler.java | 4 ++--
...reateShardingBroadcastTableRulesBackendHandler.java | 4 ++--
.../impl/CreateShardingTableRuleBackendHandler.java | 4 ++--
.../distsql/rdl/impl/DropResourceBackendHandler.java | 14 +++++++-------
.../DropShardingBindingTableRulesBackendHandler.java | 5 +++--
.../DropShardingBroadcastTableRulesBackendHandler.java | 5 +++--
.../rdl/impl/DropShardingTableRuleBackendHandler.java | 5 +++--
.../text/distsql/rdl/impl/RDLBackendHandler.java | 4 ++--
.../text/distsql/RDLBackendHandlerFactoryTest.java | 8 ++++----
24 files changed, 77 insertions(+), 80 deletions(-)
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/SQLNotificationEvent.java
similarity index 63%
copy from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java
copy to shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/SQLNotificationEvent.java
index dd621ed..2ed668a 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/SQLNotificationEvent.java
@@ -15,22 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.governance.core.registry.config.event.rule;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-
-import java.util.Collection;
+package org.apache.shardingsphere.governance.core.registry;
/**
- * Rule configurations altered event.
+ * SQL notification event.
*/
-@RequiredArgsConstructor
-@Getter
-public final class RuleConfigurationsAlteredEvent {
-
- private final String schemaName;
-
- private final Collection<RuleConfiguration> ruleConfigurations;
+public interface SQLNotificationEvent {
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedEvent.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedSQLNotificationEvent.java
similarity index 85%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedEvent.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedSQLNotificationEvent.java
index 03df533..abff8c5 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAddedSQLNotificationEvent.java
@@ -19,17 +19,17 @@ package org.apache.shardingsphere.governance.core.registry.config.event.datasour
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.governance.core.registry.GovernanceEvent;
+import org.apache.shardingsphere.governance.core.registry.SQLNotificationEvent;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import java.util.Map;
/**
- * Data source added event.
+ * Data source added SQL notification event.
*/
@RequiredArgsConstructor
@Getter
-public final class DataSourceAddedEvent implements GovernanceEvent {
+public final class DataSourceAddedSQLNotificationEvent implements SQLNotificationEvent {
private final String schemaName;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAlteredEvent.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceDroppedSQLNotificationEvent.java
similarity index 74%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAlteredEvent.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceDroppedSQLNotificationEvent.java
index 201a035..24a2d17 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceAlteredEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/DataSourceDroppedSQLNotificationEvent.java
@@ -19,19 +19,18 @@ package org.apache.shardingsphere.governance.core.registry.config.event.datasour
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.governance.core.registry.GovernanceEvent;
-import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.governance.core.registry.SQLNotificationEvent;
-import java.util.Map;
+import java.util.Collection;
/**
- * Data source altered event.
+ * Data source dropped SQL notification event.
*/
@RequiredArgsConstructor
@Getter
-public final class DataSourceAlteredEvent implements GovernanceEvent {
+public final class DataSourceDroppedSQLNotificationEvent implements SQLNotificationEvent {
private final String schemaName;
- private final Map<String, DataSourceConfiguration> dataSourceConfigurations;
+ private final Collection<String> dataSourceNames;
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredSQLNotificationEvent.java
similarity index 83%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredSQLNotificationEvent.java
index dd621ed..39631e5 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredSQLNotificationEvent.java
@@ -19,16 +19,17 @@ package org.apache.shardingsphere.governance.core.registry.config.event.rule;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.governance.core.registry.SQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import java.util.Collection;
/**
- * Rule configurations altered event.
+ * Rule configurations altered SQL notification event.
*/
@RequiredArgsConstructor
@Getter
-public final class RuleConfigurationsAlteredEvent {
+public final class RuleConfigurationsAlteredSQLNotificationEvent implements SQLNotificationEvent {
private final String schemaName;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryService.java
index 68b146f..84cd128 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryService.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.governance.core.registry.config.service.impl;
import com.google.common.base.Strings;
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.governance.core.registry.config.service.SchemaBasedRegistryService;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedEvent;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedSQLNotificationEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceDroppedSQLNotificationEvent;
import org.apache.shardingsphere.governance.core.registry.config.node.SchemaMetadataNode;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
@@ -90,19 +90,23 @@ public final class DataSourceRegistryService implements SchemaBasedRegistryServi
* @param event data source added event
*/
@Subscribe
- public void update(final DataSourceAddedEvent event) {
+ public void update(final DataSourceAddedSQLNotificationEvent event) {
Map<String, DataSourceConfiguration> dataSourceConfigs = load(event.getSchemaName());
dataSourceConfigs.putAll(event.getDataSourceConfigurations());
persist(event.getSchemaName(), dataSourceConfigs);
}
/**
- * Update data source configurations for alter.
+ * Update data source configurations for drop.
*
- * @param event data source altered event
+ * @param event data source dropped event
*/
@Subscribe
- public void update(final DataSourceAlteredEvent event) {
- persist(event.getSchemaName(), event.getDataSourceConfigurations());
+ public void update(final DataSourceDroppedSQLNotificationEvent event) {
+ Map<String, DataSourceConfiguration> dataSourceConfigs = load(event.getSchemaName());
+ for (String each : event.getDataSourceNames()) {
+ dataSourceConfigs.remove(each);
+ }
+ persist(event.getSchemaName(), dataSourceConfigs);
}
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryService.java
index 9ffde4b..8d1ac7c 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryService.java
@@ -22,7 +22,7 @@ import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.governance.core.registry.config.service.SchemaBasedRegistryService;
import org.apache.shardingsphere.governance.core.registry.config.node.SchemaMetadataNode;
import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationCheckerFactory;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
@@ -86,7 +86,7 @@ public final class SchemaRuleRegistryService implements SchemaBasedRegistryServi
* @param event rule configurations altered event
*/
@Subscribe
- public void update(final RuleConfigurationsAlteredEvent event) {
+ public void update(final RuleConfigurationsAlteredSQLNotificationEvent event) {
persist(event.getSchemaName(), event.getRuleConfigurations());
}
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryServiceTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryServiceTest.java
index ac92d11..36fd9e5 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryServiceTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/DataSourceRegistryServiceTest.java
@@ -19,8 +19,8 @@ package org.apache.shardingsphere.governance.core.registry.config.service.impl;
import lombok.SneakyThrows;
import org.apache.shardingsphere.governance.core.registry.MockDataSource;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedEvent;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedSQLNotificationEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceDroppedSQLNotificationEvent;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.junit.Before;
@@ -36,6 +36,7 @@ import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
+import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
@@ -95,14 +96,14 @@ public final class DataSourceRegistryServiceTest {
@Test
public void assertUpdateWithDataSourceAddedEvent() {
- DataSourceAddedEvent event = new DataSourceAddedEvent("foo_db", createDataSourceConfigurations());
+ DataSourceAddedSQLNotificationEvent event = new DataSourceAddedSQLNotificationEvent("foo_db", createDataSourceConfigurations());
dataSourceRegistryService.update(event);
verify(registryCenterRepository).persist(startsWith("/metadata/foo_db/dataSources"), anyString());
}
@Test
public void assertUpdateWithDataSourceAlteredEvent() {
- DataSourceAlteredEvent event = new DataSourceAlteredEvent("foo_db", createDataSourceConfigurations());
+ DataSourceDroppedSQLNotificationEvent event = new DataSourceDroppedSQLNotificationEvent("foo_db", Collections.singletonList("ds_0"));
dataSourceRegistryService.update(event);
verify(registryCenterRepository).persist(startsWith("/metadata/foo_db/dataSources"), anyString());
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryServiceTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryServiceTest.java
index 49b6a17..3de863c 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryServiceTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/service/impl/SchemaRuleRegistryServiceTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry.config.service.impl;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.junit.Before;
import org.junit.Test;
@@ -71,7 +71,7 @@ public final class SchemaRuleRegistryServiceTest {
@Test
public void assertUpdate() {
- RuleConfigurationsAlteredEvent event = new RuleConfigurationsAlteredEvent("foo_db", Collections.emptyList());
+ RuleConfigurationsAlteredSQLNotificationEvent event = new RuleConfigurationsAlteredSQLNotificationEvent("foo_db", Collections.emptyList());
schemaRuleRegistryService.update(event);
verify(registryCenterRepository).persist("/metadata/foo_db/rules", "!!map []\n");
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AddResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AddResourceBackendHandler.java
index d5d1ba3..f55d025 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AddResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AddResourceBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.AddResourceStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAddedSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceValidator;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -88,6 +88,6 @@ public final class AddResourceBackendHandler extends SchemaRequiredBackendHandle
private void post(final String schemaName, final Map<String, DataSourceConfiguration> dataSources) {
// TODO Need to get the executed feedback from registry center for returning.
- ShardingSphereEventBus.getInstance().post(new DataSourceAddedEvent(schemaName, dataSources));
+ ShardingSphereEventBus.getInstance().post(new DataSourceAddedSQLNotificationEvent(schemaName, dataSources));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBindingTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBindingTableRulesBackendHandler.java
index 25675e9..2d7e2fe 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBindingTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBindingTableRulesBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import com.google.common.base.Splitter;
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterShardingBindingTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -93,7 +93,7 @@ public final class AlterShardingBindingTableRulesBackendHandler extends SchemaRe
}
private void post(final String schemaName, final Collection<RuleConfiguration> rules) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, rules));
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, rules));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBroadcastTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBroadcastTableRulesBackendHandler.java
index 676ff91..3215bd6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBroadcastTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingBroadcastTableRulesBackendHandler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterShardingBroadcastTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -55,7 +55,7 @@ public final class AlterShardingBroadcastTableRulesBackendHandler extends Schema
}
private void post(final String schemaName, final Collection<RuleConfiguration> rules) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, rules));
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, rules));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingTableRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingTableRuleBackendHandler.java
index 0d705b1..fb1b44c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingTableRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterShardingTableRuleBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterShardingTableRuleStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
@@ -113,6 +113,6 @@ public final class AlterShardingTableRuleBackendHandler extends SchemaRequiredBa
}
private void post(final String schemaName, final Collection<RuleConfiguration> rules) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, rules));
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, rules));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
index aaa9272..6469bb5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.dbdiscovery.common.yaml.converter.DatabaseDisco
import org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType;
import org.apache.shardingsphere.distsql.parser.segment.rdl.DatabaseDiscoveryRuleSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateDatabaseDiscoveryRuleStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -143,6 +143,7 @@ public final class CreateDatabaseDiscoveryRuleBackendHandler extends SchemaRequi
}
private void post(final String schemaName) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
+ ShardingSphereEventBus.getInstance().post(
+ new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateEncryptRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateEncryptRuleBackendHandler.java
index fd46d29..6c64ce1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateEncryptRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateEncryptRuleBackendHandler.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfigu
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.converter.EncryptRuleStatementConverter;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -118,7 +118,7 @@ public final class CreateEncryptRuleBackendHandler extends SchemaRequiredBackend
}
private void post(final String schemaName) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName,
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName,
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
index e7753ba..ba92098 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import com.google.common.base.Strings;
import org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReadwriteSplittingRuleStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -140,7 +140,7 @@ public final class CreateReadwriteSplittingRuleBackendHandler extends SchemaRequ
}
private void post(final String schemaName) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName,
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName,
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBindingTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBindingTableRulesBackendHandler.java
index 0604d1c..06dc71c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBindingTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBindingTableRulesBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import com.google.common.base.Splitter;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBindingTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -92,7 +92,7 @@ public final class CreateShardingBindingTableRulesBackendHandler extends SchemaR
}
private void post(final String schemaName, final Collection<RuleConfiguration> rules) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, rules));
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, rules));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBroadcastTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBroadcastTableRulesBackendHandler.java
index 9235c6e..86ffff1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBroadcastTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingBroadcastTableRulesBackendHandler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBroadcastTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -60,7 +60,7 @@ public final class CreateShardingBroadcastTableRulesBackendHandler extends Schem
}
private void post(final String schemaName, final Collection<RuleConfiguration> rules) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, rules));
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, rules));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingTableRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingTableRuleBackendHandler.java
index 11bf2f0..57a03b7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingTableRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateShardingTableRuleBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingTableRuleStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -87,7 +87,7 @@ public final class CreateShardingTableRuleBackendHandler extends SchemaRequiredB
}
private void post(final String schemaName) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName,
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName,
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
// TODO Need to get the executed feedback from registry center for returning.
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
index 1fbdb1e..d5fe21b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
@@ -18,8 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropResourceStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceAlteredEvent;
-import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
+import org.apache.shardingsphere.governance.core.registry.config.event.datasource.DataSourceDroppedSQLNotificationEvent;
import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
@@ -52,9 +51,10 @@ public final class DropResourceBackendHandler extends SchemaRequiredBackendHandl
@Override
public ResponseHeader execute(final String schemaName, final DropResourceStatement sqlStatement) {
- check(schemaName, sqlStatement.getResourceNames());
- drop(schemaName, sqlStatement.getResourceNames());
- post(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources());
+ Collection<String> toBeDroppedResourceNames = sqlStatement.getResourceNames();
+ check(schemaName, toBeDroppedResourceNames);
+ drop(schemaName, toBeDroppedResourceNames);
+ post(schemaName, toBeDroppedResourceNames);
return new UpdateResponseHeader(sqlStatement);
}
@@ -113,7 +113,7 @@ public final class DropResourceBackendHandler extends SchemaRequiredBackendHandl
}
}
- private void post(final String schemaName, final Map<String, DataSource> dataSources) {
- ShardingSphereEventBus.getInstance().post(new DataSourceAlteredEvent(schemaName, DataSourceConverter.getDataSourceConfigurationMap(dataSources)));
+ private void post(final String schemaName, final Collection<String> toBeDroppedResourceNames) {
+ ShardingSphereEventBus.getInstance().post(new DataSourceDroppedSQLNotificationEvent(schemaName, toBeDroppedResourceNames));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBindingTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBindingTableRulesBackendHandler.java
index 1e85859..6f54c52 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBindingTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBindingTableRulesBackendHandler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBindingTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -60,7 +60,8 @@ public final class DropShardingBindingTableRulesBackendHandler extends SchemaReq
private void post(final String schemaName) {
// TODO should use RuleConfigurationsChangeEvent
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
+ ShardingSphereEventBus.getInstance().post(
+ new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBroadcastTableRulesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBroadcastTableRulesBackendHandler.java
index 6abbee4..113f371 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBroadcastTableRulesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingBroadcastTableRulesBackendHandler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBroadcastTableRulesStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -57,7 +57,8 @@ public final class DropShardingBroadcastTableRulesBackendHandler extends SchemaR
private void post(final String schemaName) {
// TODO should use RuleConfigurationsChangeEvent
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
+ ShardingSphereEventBus.getInstance().post(
+ new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingTableRuleBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingTableRuleBackendHandler.java
index 1930361..072a7c3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingTableRuleBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingTableRuleBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import com.google.common.base.Splitter;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingTableRuleStatement;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -105,7 +105,8 @@ public final class DropShardingTableRuleBackendHandler extends SchemaRequiredBac
private void post(final String schemaName) {
// TODO should use RuleConfigurationsChangeEvent
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
+ ShardingSphereEventBus.getInstance().post(
+ new RuleConfigurationsAlteredSQLNotificationEvent(schemaName, ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
// TODO Need to get the executed feedback from registry center for returning.
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/RDLBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/RDLBackendHandler.java
index 8c5a68a..2acad99 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/RDLBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/RDLBackendHandler.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredEvent;
+import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -55,7 +55,7 @@ public abstract class RDLBackendHandler<T extends SQLStatement> extends SchemaRe
protected abstract void doExecute(String schemaName, T sqlStatement);
private void after(final String schemaName) {
- ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredEvent(schemaName,
+ ShardingSphereEventBus.getInstance().post(new RuleConfigurationsAlteredSQLNotificationEvent(schemaName,
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations()));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/RDLBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/RDLBackendHandlerFactoryTest.java
index 6ed171c..2094f60 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/RDLBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/RDLBackendHandlerFactoryTest.java
@@ -194,8 +194,8 @@ public final class RDLBackendHandlerFactoryTest {
ResponseHeader response = rdlBackendHandler.get().execute();
assertThat(response, instanceOf(UpdateResponseHeader.class));
}
-
- @Test(expected = ClassCastException.class)
+
+ @Test
public void assertExecuteDropResourceContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchemaName()).thenReturn("schema");
@@ -210,7 +210,7 @@ public final class RDLBackendHandlerFactoryTest {
ResponseHeader response = rdlBackendHandler.get().execute();
assertThat(response, instanceOf(UpdateResponseHeader.class));
}
-
+
@Test(expected = ReadwriteSplittingRulesNotExistedException.class)
public void assertExecuteDropReadwriteSplittingRuleContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
@@ -242,7 +242,7 @@ public final class RDLBackendHandlerFactoryTest {
ResponseHeader response = rdlBackendHandler.get().execute();
assertThat(response, instanceOf(UpdateResponseHeader.class));
}
-
+
@Test(expected = ReadwriteSplittingRulesNotExistedException.class)
public void assertExecuteAlterReadwriteSplittingRuleContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);