This is an automated email from the ASF dual-hosted git repository.
chengzhang 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 ed3ac5362dd Refactor DatabaseAwareQueryableRALExecutor (#29859)
ed3ac5362dd is described below
commit ed3ac5362dd1504cea7fa061fb4eeb0156360931
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 25 22:15:17 2024 +0800
Refactor DatabaseAwareQueryableRALExecutor (#29859)
* Rename DataSourcePoolPropertiesValidator
* Move DatabaseAwareQueryableRALExecutor
* Refactor DatabaseAwareQueryableRALExecutor
---
.../{ => aware}/ConnectionSizeAwareQueryableRALExecutor.java | 3 ++-
.../query/{ => aware}/DatabaseAwareQueryableRALExecutor.java | 9 +++++----
.../{ => aware}/InstanceContextAwareQueryableRALExecutor.java | 3 ++-
...dateHandler.java => DataSourcePoolPropertiesValidator.java} | 7 +++----
.../update/RegisterMigrationSourceStorageUnitExecutor.java | 4 ++--
.../handler/distsql/ral/QueryableRALBackendHandler.java | 8 ++++----
.../ral/queryable/ExportDatabaseConfigurationExecutor.java | 10 +++++-----
.../distsql/ral/queryable/ShowComputeNodeInfoExecutor.java | 2 +-
.../distsql/ral/queryable/ShowComputeNodeModeExecutor.java | 2 +-
.../distsql/ral/queryable/ShowComputeNodesExecutor.java | 2 +-
.../distsql/ral/queryable/ShowDistVariableExecutor.java | 2 +-
.../distsql/ral/queryable/ShowDistVariablesExecutor.java | 2 +-
.../distsql/ral/queryable/ShowTableMetaDataExecutor.java | 10 +++++-----
.../distsql/rdl/resource/type/AlterStorageUnitExecutor.java | 4 ++--
.../distsql/rdl/resource/type/RegisterStorageUnitExecutor.java | 4 ++--
.../backend/util/YamlDatabaseConfigurationImportExecutor.java | 4 ++--
.../ral/queryable/ExportDatabaseConfigurationExecutorTest.java | 4 ++--
.../distsql/ral/queryable/ShowTableMetaDataExecutorTest.java | 2 +-
.../ral/updatable/ImportDatabaseConfigurationUpdaterTest.java | 4 ++--
.../distsql/rdl/resource/AlterStorageUnitExecutorTest.java | 4 ++--
.../distsql/rdl/resource/RegisterStorageUnitExecutorTest.java | 4 ++--
21 files changed, 48 insertions(+), 46 deletions(-)
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/ConnectionSizeAwareQueryableRALExecutor.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/ConnectionSizeAwareQueryableRALExecutor.java
similarity index 93%
rename from
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/ConnectionSizeAwareQueryableRALExecutor.java
rename to
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/ConnectionSizeAwareQueryableRALExecutor.java
index 1ff46ea78f6..de452f45a57 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/ConnectionSizeAwareQueryableRALExecutor.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/ConnectionSizeAwareQueryableRALExecutor.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.handler.type.ral.query;
+package org.apache.shardingsphere.distsql.handler.type.ral.query.aware;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.QueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.QueryableRALStatement;
/**
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/DatabaseAwareQueryableRALExecutor.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/DatabaseAwareQueryableRALExecutor.java
similarity index 86%
rename from
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/DatabaseAwareQueryableRALExecutor.java
rename to
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/DatabaseAwareQueryableRALExecutor.java
index 8d87a54c8bc..aced4c2331e 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/DatabaseAwareQueryableRALExecutor.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/DatabaseAwareQueryableRALExecutor.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.handler.type.ral.query;
+package org.apache.shardingsphere.distsql.handler.type.ral.query.aware;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.QueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.QueryableRALStatement;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -28,9 +29,9 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
public interface DatabaseAwareQueryableRALExecutor<T extends
QueryableRALStatement> extends QueryableRALExecutor<T> {
/**
- * Set current database.
+ * Set database.
*
- * @param currentDatabase current database
+ * @param database database
*/
- void setCurrentDatabase(ShardingSphereDatabase currentDatabase);
+ void setDatabase(ShardingSphereDatabase database);
}
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/InstanceContextAwareQueryableRALExecutor.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/InstanceContextAwareQueryableRALExecutor.java
similarity index 93%
rename from
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/InstanceContextAwareQueryableRALExecutor.java
rename to
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/InstanceContextAwareQueryableRALExecutor.java
index cf25d907eb3..64a55bbcd85 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/InstanceContextAwareQueryableRALExecutor.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/ral/query/aware/InstanceContextAwareQueryableRALExecutor.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.handler.type.ral.query;
+package org.apache.shardingsphere.distsql.handler.type.ral.query.aware;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.QueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.QueryableRALStatement;
import org.apache.shardingsphere.infra.instance.InstanceContext;
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidateHandler.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidator.java
similarity index 85%
rename from
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidateHandler.java
rename to
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidator.java
index a81c0ddd4e5..b55460a31a7 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidateHandler.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePoolPropertiesValidator.java
@@ -19,16 +19,15 @@ package org.apache.shardingsphere.distsql.handler.validate;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
import
org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties;
-import
org.apache.shardingsphere.infra.datasource.pool.props.validator.DataSourcePoolPropertiesValidator;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.Collection;
import java.util.Map;
/**
- * Data source pool properties validate handler.
+ * Data source pool properties validator.
*/
-public final class DataSourcePoolPropertiesValidateHandler {
+public final class DataSourcePoolPropertiesValidator {
/**
* Validate data source properties map.
@@ -37,7 +36,7 @@ public final class DataSourcePoolPropertiesValidateHandler {
* @throws InvalidStorageUnitsException invalid storage units exception
*/
public void validate(final Map<String, DataSourcePoolProperties> propsMap)
{
- Collection<String> errorMessages =
DataSourcePoolPropertiesValidator.validate(propsMap);
+ Collection<String> errorMessages =
org.apache.shardingsphere.infra.datasource.pool.props.validator.DataSourcePoolPropertiesValidator.validate(propsMap);
ShardingSpherePreconditions.checkState(errorMessages.isEmpty(), () ->
new InvalidStorageUnitsException(errorMessages));
}
}
diff --git
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/update/RegisterMigrationSourceStorageUnitExecutor.java
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/update/RegisterMigrationSourceStorageUnitExecutor.java
index 4f3d4a6a4db..5605090c774 100644
---
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/update/RegisterMigrationSourceStorageUnitExecutor.java
+++
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/update/RegisterMigrationSourceStorageUnitExecutor.java
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.data.pipeline.core.context.PipelineContextKey;
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.api.MigrationJobAPI;
import
org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import
org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
@@ -46,7 +46,7 @@ public final class RegisterMigrationSourceStorageUnitExecutor
implements Updatab
private final MigrationJobAPI jobAPI = (MigrationJobAPI)
TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION");
- private final DataSourcePoolPropertiesValidateHandler validateHandler =
new DataSourcePoolPropertiesValidateHandler();
+ private final DataSourcePoolPropertiesValidator validateHandler = new
DataSourcePoolPropertiesValidator();
@Override
public void executeUpdate(final
RegisterMigrationSourceStorageUnitStatement sqlStatement) {
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java
index 34939e1eb26..df3c613651c 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java
@@ -18,9 +18,9 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.ConnectionSizeAwareQueryableRALExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.DatabaseAwareQueryableRALExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.InstanceContextAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.ConnectionSizeAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.DatabaseAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.InstanceContextAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.handler.type.ral.query.QueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.QueryableRALStatement;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
@@ -74,7 +74,7 @@ public final class QueryableRALBackendHandler<T extends
QueryableRALStatement> i
((InstanceContextAwareQueryableRALExecutor<T>)
executor).setInstanceContext(ProxyContext.getInstance().getContextManager().getInstanceContext());
}
if (executor instanceof DatabaseAwareQueryableRALExecutor) {
- ((DatabaseAwareQueryableRALExecutor<T>)
executor).setCurrentDatabase(ProxyContext.getInstance().getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement,
connectionSession)));
+ ((DatabaseAwareQueryableRALExecutor<T>)
executor).setDatabase(ProxyContext.getInstance().getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement,
connectionSession)));
}
if (executor instanceof ConnectionSizeAwareQueryableRALExecutor) {
((ConnectionSizeAwareQueryableRALExecutor<T>)
executor).setConnectionSize(connectionSession.getDatabaseConnectionManager().getConnectionSize());
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
index 751e13b4f8b..e489d4c1a26 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.DatabaseAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.DatabaseAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.export.ExportDatabaseConfigurationStatement;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -34,7 +34,7 @@ import java.util.Collections;
@Setter
public final class ExportDatabaseConfigurationExecutor implements
DatabaseAwareQueryableRALExecutor<ExportDatabaseConfigurationStatement> {
- private ShardingSphereDatabase currentDatabase;
+ private ShardingSphereDatabase database;
@Override
public Collection<String> getColumnNames() {
@@ -43,7 +43,7 @@ public final class ExportDatabaseConfigurationExecutor
implements DatabaseAwareQ
@Override
public Collection<LocalDataQueryResultRow> getRows(final
ExportDatabaseConfigurationStatement sqlStatement, final ShardingSphereMetaData
metaData) {
- String exportedData =
ExportUtils.generateExportDatabaseData(currentDatabase);
+ String exportedData = ExportUtils.generateExportDatabaseData(database);
if (!sqlStatement.getFilePath().isPresent()) {
return Collections.singleton(new
LocalDataQueryResultRow(exportedData));
}
@@ -53,8 +53,8 @@ public final class ExportDatabaseConfigurationExecutor
implements DatabaseAwareQ
}
@Override
- public void setCurrentDatabase(final ShardingSphereDatabase
currentDatabase) {
- this.currentDatabase = currentDatabase;
+ public void setDatabase(final ShardingSphereDatabase database) {
+ this.database = database;
}
@Override
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutor.java
index 8a64931cb18..9bddab19a00 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeInfoExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.InstanceContextAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.InstanceContextAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowComputeNodeInfoStatement;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.InstanceContext;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeModeExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeModeExecutor.java
index c89a66363f7..31f39c32418 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeModeExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodeModeExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.InstanceContextAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.InstanceContextAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowComputeNodeModeStatement;
import
org.apache.shardingsphere.infra.config.mode.PersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutor.java
index 4ddefea0b41..fa323ec4a92 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowComputeNodesExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.InstanceContextAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.InstanceContextAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowComputeNodesStatement;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.InstanceContext;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
index b5669cd21de..af5e2c44d34 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
@@ -30,7 +30,7 @@ import
org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
import org.apache.shardingsphere.logging.util.LoggingUtils;
import
org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableException;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.DistSQLVariable;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.ConnectionSizeAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.ConnectionSizeAwareQueryableRALExecutor;
import java.util.Arrays;
import java.util.Collection;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
index 6854c1d4124..fbffb6649c8 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
@@ -28,7 +28,7 @@ import
org.apache.shardingsphere.logging.constant.LoggingConstants;
import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
import org.apache.shardingsphere.logging.util.LoggingUtils;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.DistSQLVariable;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.ConnectionSizeAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.ConnectionSizeAwareQueryableRALExecutor;
import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtils;
import java.util.Arrays;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutor.java
index 771291b7268..c66dd20317f 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.ral.query.DatabaseAwareQueryableRALExecutor;
+import
org.apache.shardingsphere.distsql.handler.type.ral.query.aware.DatabaseAwareQueryableRALExecutor;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowTableMetaDataStatement;
import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
@Setter
public final class ShowTableMetaDataExecutor implements
DatabaseAwareQueryableRALExecutor<ShowTableMetaDataStatement> {
- private ShardingSphereDatabase currentDatabase;
+ private ShardingSphereDatabase database;
@Override
public Collection<String> getColumnNames() {
@@ -50,10 +50,10 @@ public final class ShowTableMetaDataExecutor implements
DatabaseAwareQueryableRA
@Override
public Collection<LocalDataQueryResultRow> getRows(final
ShowTableMetaDataStatement sqlStatement, final ShardingSphereMetaData metaData)
{
- String defaultSchema = new
DatabaseTypeRegistry(currentDatabase.getProtocolType()).getDefaultSchemaName(currentDatabase.getName());
- ShardingSphereSchema schema = currentDatabase.getSchema(defaultSchema);
+ String defaultSchema = new
DatabaseTypeRegistry(database.getProtocolType()).getDefaultSchemaName(database.getName());
+ ShardingSphereSchema schema = database.getSchema(defaultSchema);
return sqlStatement.getTableNames().stream().filter(each ->
schema.getAllTableNames().contains(each.toLowerCase()))
- .map(each -> buildTableRows(currentDatabase.getName(), schema,
each.toLowerCase())).flatMap(Collection::stream).collect(Collectors.toList());
+ .map(each -> buildTableRows(database.getName(), schema,
each.toLowerCase())).flatMap(Collection::stream).collect(Collectors.toList());
}
private Collection<LocalDataQueryResultRow> buildTableRows(final String
databaseName, final ShardingSphereSchema schema, final String tableName) {
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/AlterStorageUnitExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/AlterStorageUnitExecutor.java
index 4fe67c747fb..f8b003fc605 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/AlterStorageUnitExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/AlterStorageUnitExecutor.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.distsql.handler.exception.storageunit.Duplicate
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException;
import
org.apache.shardingsphere.distsql.handler.type.rdl.resource.aware.DatabaseAwareResourceDefinitionExecutor;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import
org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
@@ -54,7 +54,7 @@ import java.util.stream.Collectors;
@Setter
public final class AlterStorageUnitExecutor implements
DatabaseAwareResourceDefinitionExecutor<AlterStorageUnitStatement> {
- private final DataSourcePoolPropertiesValidateHandler validateHandler =
new DataSourcePoolPropertiesValidateHandler();
+ private final DataSourcePoolPropertiesValidator validateHandler = new
DataSourcePoolPropertiesValidator();
private ShardingSphereDatabase database;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/RegisterStorageUnitExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/RegisterStorageUnitExecutor.java
index e02b5e36ed0..2feabee9966 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/RegisterStorageUnitExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/type/RegisterStorageUnitExecutor.java
@@ -22,7 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.DuplicateStorageUnitException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
import
org.apache.shardingsphere.distsql.handler.type.rdl.resource.aware.DatabaseAwareResourceDefinitionExecutor;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import
org.apache.shardingsphere.distsql.segment.converter.DataSourceSegmentsConverter;
import
org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.RegisterStorageUnitStatement;
@@ -48,7 +48,7 @@ import java.util.stream.Collectors;
@Slf4j
public final class RegisterStorageUnitExecutor implements
DatabaseAwareResourceDefinitionExecutor<RegisterStorageUnitStatement> {
- private final DataSourcePoolPropertiesValidateHandler validateHandler =
new DataSourcePoolPropertiesValidateHandler();
+ private final DataSourcePoolPropertiesValidator validateHandler = new
DataSourcePoolPropertiesValidator();
private ShardingSphereDatabase database;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
index f510c7cb376..1eb0bfb4c28 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfigur
import
org.apache.shardingsphere.broadcast.yaml.swapper.YamlBroadcastRuleConfigurationSwapper;
import
org.apache.shardingsphere.distsql.handler.exception.datasource.MissingRequiredDataSourcesException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
@@ -106,7 +106,7 @@ public final class YamlDatabaseConfigurationImportExecutor {
private final YamlProxyDataSourceConfigurationSwapper
dataSourceConfigSwapper = new YamlProxyDataSourceConfigurationSwapper();
- private final DataSourcePoolPropertiesValidateHandler validateHandler =
new DataSourcePoolPropertiesValidateHandler();
+ private final DataSourcePoolPropertiesValidator validateHandler = new
DataSourcePoolPropertiesValidator();
/**
* Import proxy database from yaml configuration.
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java
index a99c11c6774..7165d1b1708 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java
@@ -75,7 +75,7 @@ class ExportDatabaseConfigurationExecutorTest {
when(database.getResourceMetaData().getStorageUnits()).thenReturn(storageUnits);
when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration()));
ExportDatabaseConfigurationExecutor executor = new
ExportDatabaseConfigurationExecutor();
- executor.setCurrentDatabase(database);
+ executor.setDatabase(database);
Collection<LocalDataQueryResultRow> actual = executor.getRows(new
ExportDatabaseConfigurationStatement(mock(DatabaseSegment.class), null),
mock(ShardingSphereMetaData.class));
assertThat(actual.size(), is(1));
LocalDataQueryResultRow row = actual.iterator().next();
@@ -101,7 +101,7 @@ class ExportDatabaseConfigurationExecutorTest {
when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList());
ExportDatabaseConfigurationStatement sqlStatement = new
ExportDatabaseConfigurationStatement(new DatabaseSegment(0, 0, new
IdentifierValue("empty_db")), null);
ExportDatabaseConfigurationExecutor executor = new
ExportDatabaseConfigurationExecutor();
- executor.setCurrentDatabase(database);
+ executor.setDatabase(database);
Collection<LocalDataQueryResultRow> actual =
executor.getRows(sqlStatement, mock(ShardingSphereMetaData.class));
assertThat(actual.size(), is(1));
LocalDataQueryResultRow row = actual.iterator().next();
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutorTest.java
index 504d0bd0e42..22431885c76 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTableMetaDataExecutorTest.java
@@ -55,7 +55,7 @@ class ShowTableMetaDataExecutorTest {
void assertExecute() {
ShardingSphereDatabase database = mockDatabase();
ShowTableMetaDataExecutor executor = new ShowTableMetaDataExecutor();
- executor.setCurrentDatabase(database);
+ executor.setDatabase(database);
Collection<LocalDataQueryResultRow> actual =
executor.getRows(createSqlStatement(), mock(ShardingSphereMetaData.class));
assertThat(actual.size(), is(2));
Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
index 86396c8ef27..fbf81231cce 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.distsql.handler.exception.datasource.MissingRequiredDataSourcesException;
import
org.apache.shardingsphere.distsql.handler.exception.rule.DuplicateRuleException;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import
org.apache.shardingsphere.distsql.statement.ral.updatable.ImportDatabaseConfigurationStatement;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
@@ -131,7 +131,7 @@ class ImportDatabaseConfigurationUpdaterTest {
importDatabaseConfigUpdater = new
ImportDatabaseConfigurationExecutor();
YamlDatabaseConfigurationImportExecutor databaseConfigImportExecutor =
new YamlDatabaseConfigurationImportExecutor();
Plugins.getMemberAccessor().set(importDatabaseConfigUpdater.getClass().getDeclaredField("databaseConfigImportExecutor"),
importDatabaseConfigUpdater, databaseConfigImportExecutor);
-
Plugins.getMemberAccessor().set(databaseConfigImportExecutor.getClass().getDeclaredField("validateHandler"),
databaseConfigImportExecutor,
mock(DataSourcePoolPropertiesValidateHandler.class));
+
Plugins.getMemberAccessor().set(databaseConfigImportExecutor.getClass().getDeclaredField("validateHandler"),
databaseConfigImportExecutor, mock(DataSourcePoolPropertiesValidator.class));
}
private ContextManager mockContextManager(final String databaseName) {
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterStorageUnitExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterStorageUnitExecutorTest.java
index 2a54850581c..c86e57726a0 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterStorageUnitExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterStorageUnitExecutorTest.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.resource;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.DuplicateStorageUnitException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import
org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
import
org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.AlterStorageUnitStatement;
@@ -63,7 +63,7 @@ class AlterStorageUnitExecutorTest {
@BeforeEach
void setUp() throws ReflectiveOperationException {
executor = new AlterStorageUnitExecutor();
-
Plugins.getMemberAccessor().set(executor.getClass().getDeclaredField("validateHandler"),
executor, mock(DataSourcePoolPropertiesValidateHandler.class));
+
Plugins.getMemberAccessor().set(executor.getClass().getDeclaredField("validateHandler"),
executor, mock(DataSourcePoolPropertiesValidator.class));
}
@Test
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/RegisterStorageUnitExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/RegisterStorageUnitExecutorTest.java
index 39723bd220c..d1583ecc570 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/RegisterStorageUnitExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/RegisterStorageUnitExecutorTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.resource;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.DuplicateStorageUnitException;
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
-import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
+import
org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import
org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
@@ -67,7 +67,7 @@ class RegisterStorageUnitExecutorTest {
when(database.getName()).thenReturn("foo_db");
when(database.getRuleMetaData()).thenReturn(mock(RuleMetaData.class));
executor = new RegisterStorageUnitExecutor();
-
Plugins.getMemberAccessor().set(executor.getClass().getDeclaredField("validateHandler"),
executor, mock(DataSourcePoolPropertiesValidateHandler.class));
+
Plugins.getMemberAccessor().set(executor.getClass().getDeclaredField("validateHandler"),
executor, mock(DataSourcePoolPropertiesValidator.class));
}
@Test