This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 8c93b6acb8f Rename AlterReadwriteSplittingStorageUnitStatusExecutor
(#29838)
8c93b6acb8f is described below
commit 8c93b6acb8f94c7d16deb4140456afd0f19f1104
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jan 24 21:15:34 2024 +0800
Rename AlterReadwriteSplittingStorageUnitStatusExecutor (#29838)
---
.../AlterReadwriteSplittingStorageUnitStatusExecutor.java} | 10 +++++-----
.../ShowStatusFromReadwriteSplittingRulesExecutor.java | 3 ++-
...sphere.distsql.handler.type.ral.update.UpdatableRALExecutor | 2 +-
....apache.shardingsphere.distsql.handler.type.rql.RQLExecutor | 2 +-
.../ShowStatusFromReadwriteSplittingRulesExecutorTest.java | 2 +-
...eadwriteSplittingStorageUnitStatusStatementUpdaterTest.java | 5 +++--
6 files changed, 13 insertions(+), 11 deletions(-)
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/readwritesplitting/AlterReadwriteSplittingStorageUnitStatusExecutor.java
similarity index 96%
rename from
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementExecutor.java
rename to
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/readwritesplitting/AlterReadwriteSplittingStorageUnitStatusExecutor.java
index 954ee5b4189..2beced399a1 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/readwritesplitting/AlterReadwriteSplittingStorageUnitStatusExecutor.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
+package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.readwritesplitting;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
@@ -36,7 +36,6 @@ import
org.apache.shardingsphere.mode.event.storage.StorageNodeDataSource;
import org.apache.shardingsphere.mode.event.storage.StorageNodeRole;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.service.StorageNodeStatusService;
-import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import
org.apache.shardingsphere.readwritesplitting.distsql.statement.status.AlterReadwriteSplittingStorageUnitStatusStatement;
import
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
@@ -51,10 +50,11 @@ import java.util.Optional;
import java.util.stream.Collectors;
/**
- * Set readwrite-splitting storage unit status executor.
+ * Alter readwrite-splitting storage unit status executor.
*/
+// TODO move to readwritesplitting module
@Setter
-public final class AlterReadwriteSplittingStorageUnitStatusStatementExecutor
implements
DatabaseAwareUpdatableRALExecutor<AlterReadwriteSplittingStorageUnitStatusStatement>
{
+public final class AlterReadwriteSplittingStorageUnitStatusExecutor implements
DatabaseAwareUpdatableRALExecutor<AlterReadwriteSplittingStorageUnitStatusStatement>
{
private static final String DISABLE = "DISABLE";
@@ -178,7 +178,7 @@ public final class
AlterReadwriteSplittingStorageUnitStatusStatementExecutor imp
}
private Collection<QualifiedDatabase> getDisabledStorageNodes(final
MetaDataBasedPersistService persistService) {
- Map<String, StorageNodeDataSource> storageNodes = new
StorageNodeStatusService((ClusterPersistRepository)
persistService.getRepository()).loadStorageNodes();
+ Map<String, StorageNodeDataSource> storageNodes = new
StorageNodeStatusService(persistService.getRepository()).loadStorageNodes();
return storageNodes.entrySet().stream().filter(each ->
DataSourceState.DISABLED == each.getValue().getStatus())
.map(each -> new QualifiedDatabase(each.getKey())).filter(each
->
database.getName().equalsIgnoreCase(each.getDatabaseName())).collect(Collectors.toList());
}
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/ShowStatusFromReadwriteSplittingRulesExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/readwritesplitting/ShowStatusFromReadwriteSplittingRulesExecutor.java
similarity index 99%
rename from
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/ShowStatusFromReadwriteSplittingRulesExecutor.java
rename to
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/readwritesplitting/ShowStatusFromReadwriteSplittingRulesExecutor.java
index caa3c6d4048..a7041416dff 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/ShowStatusFromReadwriteSplittingRulesExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/type/readwritesplitting/ShowStatusFromReadwriteSplittingRulesExecutor.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type;
+package
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.readwritesplitting;
import com.google.common.base.Strings;
import lombok.Setter;
@@ -52,6 +52,7 @@ import java.util.stream.Collectors;
/**
* Show status from readwrite-splitting rules executor.
*/
+// TODO move to readwritesplitting module
@Setter
public final class ShowStatusFromReadwriteSplittingRulesExecutor
implements
diff --git
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor
index 1007dffc323..b99508e07d9 100644
---
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor
+++
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor
@@ -21,7 +21,7 @@
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.UnlabelCom
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetInstanceStatusExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.ImportDatabaseConfigurationExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.ImportMetaDataExecutor
-org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.AlterReadwriteSplittingStorageUnitStatusStatementExecutor
+org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.readwritesplitting.AlterReadwriteSplittingStorageUnitStatusExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetDistVariableExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.RefreshDatabaseMetaDataExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.LockClusterExecutor
diff --git
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 9b3f94a5f9c..c0553098c49 100644
---
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -18,4 +18,4 @@
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.ShowStorageUnitExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.ShowRulesUsedStorageUnitExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.ShowLogicalTableExecutor
-org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.ShowStatusFromReadwriteSplittingRulesExecutor
+org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.readwritesplitting.ShowStatusFromReadwriteSplittingRulesExecutor
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java
index 3e42156be64..310860ae16e 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import
org.apache.shardingsphere.mode.repository.cluster.zookeeper.ZookeeperRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.ShowStatusFromReadwriteSplittingRulesExecutor;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.type.readwritesplitting.ShowStatusFromReadwriteSplittingRulesExecutor;
import
org.apache.shardingsphere.readwritesplitting.distsql.statement.ShowStatusFromReadwriteSplittingRulesStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest.java
index a5e34fba495..c88a6c18733 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.readwritesplitting.AlterReadwriteSplittingStorageUnitStatusExecutor;
import
org.apache.shardingsphere.readwritesplitting.distsql.statement.status.AlterReadwriteSplittingStorageUnitStatusStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
@@ -40,7 +41,7 @@ class
AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest {
@Test
void assertWithStandaloneMode() {
- AlterReadwriteSplittingStorageUnitStatusStatementExecutor updater =
new AlterReadwriteSplittingStorageUnitStatusStatementExecutor();
+ AlterReadwriteSplittingStorageUnitStatusExecutor updater = new
AlterReadwriteSplittingStorageUnitStatusExecutor();
when(ProxyContext.getInstance().getContextManager()).thenReturn(mock(ContextManager.class,
RETURNS_DEEP_STUBS));
assertThrows(UnsupportedSQLOperationException.class,
() -> updater.executeUpdate(new
AlterReadwriteSplittingStorageUnitStatusStatement(new DatabaseSegment(1, 1, new
IdentifierValue("foo_db")), "group", "read_ds", "ENABLE")));
@@ -52,7 +53,7 @@ class
AlterReadwriteSplittingStorageUnitStatusStatementUpdaterTest {
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class,
RETURNS_DEEP_STUBS);
when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database);
- AlterReadwriteSplittingStorageUnitStatusStatementExecutor updater =
new AlterReadwriteSplittingStorageUnitStatusStatementExecutor();
+ AlterReadwriteSplittingStorageUnitStatusExecutor updater = new
AlterReadwriteSplittingStorageUnitStatusExecutor();
updater.setDatabase(database);
assertThrows(UnsupportedSQLOperationException.class,
() -> updater.executeUpdate(new
AlterReadwriteSplittingStorageUnitStatusStatement(new DatabaseSegment(1, 1, new
IdentifierValue("foo_db")), "group", "read_ds", "ENABLE")));