This is an automated email from the ASF dual-hosted git repository.
panjuan 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 489663a Complete disable salve data source by DistSQL (#12845)
489663a is described below
commit 489663a2167e51c4a6b186cb914fc83c88a57a97
Author: Haoran Meng <[email protected]>
AuthorDate: Thu Sep 30 14:27:21 2021 +0800
Complete disable salve data source by DistSQL (#12845)
---
.../common/set/excutor/SetReadwriteSplittingStatusExecutor.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetReadwriteSplittingStatusExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetReadwriteSplittingStatusExecutor.java
index 08f3ad9..bbf40b5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetReadwriteSplittingStatusExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetReadwriteSplittingStatusExecutor.java
@@ -20,8 +20,9 @@ package
org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.set.excu
import lombok.AllArgsConstructor;
import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import
org.apache.shardingsphere.infra.distsql.exception.resource.RequiredResourceMissedException;
+import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
-import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
+import org.apache.shardingsphere.infra.rule.event.impl.DataSourceDisabledEvent;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import
org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
@@ -32,7 +33,6 @@ import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.sta
import java.util.Collection;
import java.util.Collections;
-import java.util.Optional;
/**
* Set readwrite-splitting status executor.
@@ -56,8 +56,7 @@ public final class SetReadwriteSplittingStatusExecutor
implements SetStatementEx
String resourceName = sqlStatement.getResourceName();
Collection<String> notExistedResources =
ProxyContext.getInstance().getMetaData(schemaName).getResource().getNotExistedResources(Collections.singleton(resourceName));
DistSQLException.predictionThrow(notExistedResources.isEmpty(), new
RequiredResourceMissedException(schemaName,
Collections.singleton(resourceName)));
- Optional<MetaDataPersistService> persistService =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaDataPersistService();
- //TODO Need to disable slave data source API support
+ ShardingSphereEventBus.getInstance().post(new
DataSourceDisabledEvent(schemaName, resourceName,
"DISABLE".equals(sqlStatement.getStatus())));
return new UpdateResponseHeader(sqlStatement);
}
}