This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 0316e316140 Fixes #25113. (#25118)
0316e316140 is described below
commit 0316e3161408542f673d7e2f0c032f6e2d417d39
Author: Raigor <[email protected]>
AuthorDate: Wed Apr 12 08:16:24 2023 +0800
Fixes #25113. (#25118)
---
.../metadata/data/ShardingStatisticsTableCollector.java | 3 ++-
.../token/generator/impl/ProjectionsTokenGenerator.java | 5 ++---
.../select/projection/impl/AggregationProjection.java | 6 ++----
.../infra/binder/segment/table/TablesContext.java | 6 ++----
.../database/schema/builder/SystemSchemaBuilder.java | 5 ++---
.../schema/loader/common/SchemaMetaDataLoader.java | 7 +++----
.../metadata/database/schema/util/SystemSchemaUtils.java | 5 ++---
.../driver/jdbc/adapter/AbstractStatementAdapter.java | 5 ++---
.../data/pipeline/core/util/JDBCStreamQueryUtils.java | 5 ++---
.../advanced/resultset/SQLFederationResultSet.java | 6 ++----
.../shardingsphere/mode/metadata/MetaDataContexts.java | 6 +++---
.../handler/transaction/TransactionBackendHandler.java | 15 +++++++--------
.../e2e/data/pipeline/cases/task/E2EIncrementalTask.java | 7 +++----
.../pipeline/framework/helper/PipelineCaseHelper.java | 5 ++---
14 files changed, 36 insertions(+), 50 deletions(-)
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java
index 341f8e7d106..98614cb50dc 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.sharding.metadata.data;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
@@ -61,7 +62,7 @@ public final class ShardingStatisticsTableCollector
implements ShardingSphereDat
final Map<String,
ShardingSphereDatabase> shardingSphereDatabases) throws SQLException {
ShardingSphereTableData result = new
ShardingSphereTableData(SHARDING_TABLE_STATISTICS);
DatabaseType protocolType =
shardingSphereDatabases.values().iterator().next().getProtocolType();
- if (protocolType instanceof PostgreSQLDatabaseType || protocolType
instanceof OpenGaussDatabaseType) {
+ if (protocolType instanceof SchemaSupportedDatabaseType) {
collectFromDatabase(shardingSphereDatabases.get(databaseName),
result);
} else {
for (ShardingSphereDatabase each :
shardingSphereDatabases.values()) {
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ProjectionsTokenGenerator.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ProjectionsTokenGenerator.java
index f97cee5c964..f790de1937a 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ProjectionsTokenGenerator.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ProjectionsTokenGenerator.java
@@ -26,9 +26,8 @@ import
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.Der
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.database.type.dialect.OracleDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import
org.apache.shardingsphere.infra.rewrite.sql.token.generator.OptionalSQLTokenGenerator;
import
org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.RouteContextAware;
import org.apache.shardingsphere.infra.route.context.RouteContext;
@@ -141,7 +140,7 @@ public final class ProjectionsTokenGenerator implements
OptionalSQLTokenGenerato
}
private NullsOrderType generateNewNullsOrderType(final DatabaseType
databaseType, final OrderDirection orderDirection) {
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType
instanceof OpenGaussDatabaseType || databaseType instanceof OracleDatabaseType)
{
+ if (databaseType instanceof SchemaSupportedDatabaseType ||
databaseType instanceof OracleDatabaseType) {
return OrderDirection.ASC.equals(orderDirection) ?
NullsOrderType.LAST : NullsOrderType.FIRST;
}
return OrderDirection.ASC.equals(orderDirection) ?
NullsOrderType.FIRST : NullsOrderType.LAST;
diff --git
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
index 7abc2b5a9c4..7a479b9cf92 100644
---
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
+++
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
@@ -24,8 +24,7 @@ import lombok.Setter;
import lombok.ToString;
import
org.apache.shardingsphere.infra.binder.segment.select.projection.Projection;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.sql.parser.sql.common.enums.AggregationType;
import java.util.ArrayList;
@@ -71,8 +70,7 @@ public class AggregationProjection implements Projection {
*/
@Override
public String getColumnLabel() {
- boolean isPostgreSQLOpenGaussStatement = databaseType instanceof
PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType;
- return getAlias().orElseGet(() -> isPostgreSQLOpenGaussStatement ?
type.name().toLowerCase() : getExpression());
+ return getAlias().orElseGet(() -> databaseType instanceof
SchemaSupportedDatabaseType ? type.name().toLowerCase() : getExpression());
}
@Override
diff --git
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContext.java
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContext.java
index a6e572a53f1..1df3c6c33c6 100644
---
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContext.java
+++
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContext.java
@@ -25,8 +25,7 @@ import
org.apache.shardingsphere.infra.binder.segment.select.subquery.SubqueryTa
import
org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine;
import
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.OwnerSegment;
@@ -89,8 +88,7 @@ public final class TablesContext {
}
private Optional<String> findDatabaseName(final SimpleTableSegment
tableSegment, final DatabaseType databaseType) {
- Optional<OwnerSegment> owner = databaseType instanceof
PostgreSQLDatabaseType
- || databaseType instanceof OpenGaussDatabaseType ?
tableSegment.getOwner().flatMap(OwnerSegment::getOwner) :
tableSegment.getOwner();
+ Optional<OwnerSegment> owner = databaseType instanceof
SchemaSupportedDatabaseType ?
tableSegment.getOwner().flatMap(OwnerSegment::getOwner) :
tableSegment.getOwner();
return owner.map(optional -> optional.getIdentifier().getValue());
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilder.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilder.java
index 09dc616432e..854e86123de 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilder.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilder.java
@@ -20,8 +20,7 @@ package
org.apache.shardingsphere.infra.metadata.database.schema.builder;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
import
org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable;
@@ -58,7 +57,7 @@ public final class SystemSchemaBuilder {
}
private static Collection<String> getSystemSchemas(final String
originalDatabaseName, final DatabaseType databaseType) {
- String databaseName = databaseType instanceof PostgreSQLDatabaseType
|| databaseType instanceof OpenGaussDatabaseType ? "postgres" :
originalDatabaseName;
+ String databaseName = databaseType instanceof
SchemaSupportedDatabaseType ? "postgres" : originalDatabaseName;
return
databaseType.getSystemDatabaseSchemaMap().getOrDefault(databaseName,
Collections.emptyList());
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/common/SchemaMetaDataLoader.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/common/SchemaMetaDataLoader.java
index 2e53645c9c0..4e181c488d7 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/common/SchemaMetaDataLoader.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/common/SchemaMetaDataLoader.java
@@ -20,8 +20,7 @@ package
org.apache.shardingsphere.infra.metadata.database.schema.loader.common;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.metadata.database.schema.loader.adapter.MetaDataLoaderConnectionAdapter;
import javax.sql.DataSource;
@@ -66,7 +65,7 @@ public final class SchemaMetaDataLoader {
Collection<String> schemaNames =
loadSchemaNames(connectionAdapter, databaseType);
Map<String, Collection<String>> result = new
HashMap<>(schemaNames.size(), 1);
for (String each : schemaNames) {
- String schemaName = databaseType instanceof
PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType ? each
: databaseName;
+ String schemaName = databaseType instanceof
SchemaSupportedDatabaseType ? each : databaseName;
result.put(schemaName, loadTableNames(connectionAdapter,
each));
}
return result;
@@ -82,7 +81,7 @@ public final class SchemaMetaDataLoader {
* @throws SQLException SQL exception
*/
public static Collection<String> loadSchemaNames(final Connection
connection, final DatabaseType databaseType) throws SQLException {
- if (!(databaseType instanceof PostgreSQLDatabaseType) &&
!(databaseType instanceof OpenGaussDatabaseType)) {
+ if (!(databaseType instanceof SchemaSupportedDatabaseType)) {
return Collections.singletonList(connection.getSchema());
}
Collection<String> result = new LinkedList<>();
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
index 6cfaabb8ae0..f21af0603df 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
@@ -20,8 +20,7 @@ package
org.apache.shardingsphere.infra.metadata.database.schema.util;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import java.util.Collection;
@@ -41,7 +40,7 @@ public final class SystemSchemaUtils {
* @return whether SQL statement contains system schema or not
*/
public static boolean containsSystemSchema(final DatabaseType
databaseType, final Collection<String> schemaNames, final
ShardingSphereDatabase database) {
- if (database.isComplete() && !(databaseType instanceof
PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType)) {
+ if (database.isComplete() && !(databaseType instanceof
SchemaSupportedDatabaseType)) {
return false;
}
for (String each : schemaNames) {
diff --git
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
index b81ddaece2b..cb18db5d493 100644
---
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
+++
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
@@ -25,8 +25,7 @@ import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConne
import org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager;
import
org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationStatement;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import java.sql.SQLException;
@@ -196,7 +195,7 @@ public abstract class AbstractStatementAdapter extends
AbstractUnsupportedOperat
protected final void handleExceptionInTransaction(final
ShardingSphereConnection connection, final MetaDataContexts metaDataContexts) {
if
(connection.getConnectionManager().getConnectionTransaction().isInTransaction())
{
DatabaseType databaseType =
metaDataContexts.getMetaData().getDatabase(connection.getDatabaseName()).getProtocolType();
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType
instanceof OpenGaussDatabaseType) {
+ if (databaseType instanceof SchemaSupportedDatabaseType) {
connection.getConnectionManager().getConnectionTransaction().setRollbackOnly(true);
}
}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/JDBCStreamQueryUtils.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/JDBCStreamQueryUtils.java
index 5d036810489..88add83713c 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/JDBCStreamQueryUtils.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/JDBCStreamQueryUtils.java
@@ -20,10 +20,9 @@ package org.apache.shardingsphere.data.pipeline.core.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.BranchDatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -49,7 +48,7 @@ public final class JDBCStreamQueryUtils {
if (databaseType instanceof MySQLDatabaseType) {
return generateForMySQL(connection, sql);
}
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType
instanceof OpenGaussDatabaseType) {
+ if (databaseType instanceof SchemaSupportedDatabaseType) {
return generateForPostgreSQL(connection, sql);
}
if (databaseType instanceof H2DatabaseType) {
diff --git
a/kernel/sql-federation/executor/advanced/src/main/java/org/apache/shardingsphere/sqlfederation/advanced/resultset/SQLFederationResultSet.java
b/kernel/sql-federation/executor/advanced/src/main/java/org/apache/shardingsphere/sqlfederation/advanced/resultset/SQLFederationResultSet.java
index ee47fa6e3da..628789ef327 100644
---
a/kernel/sql-federation/executor/advanced/src/main/java/org/apache/shardingsphere/sqlfederation/advanced/resultset/SQLFederationResultSet.java
+++
b/kernel/sql-federation/executor/advanced/src/main/java/org/apache/shardingsphere/sqlfederation/advanced/resultset/SQLFederationResultSet.java
@@ -24,8 +24,7 @@ import
org.apache.shardingsphere.infra.binder.segment.select.projection.Projecti
import
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.AggregationDistinctProjection;
import
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.util.ResultSetUtils;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
import
org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -96,8 +95,7 @@ public final class SQLFederationResultSet extends
AbstractUnsupportedOperationRe
private String getColumnLabel(final Projection projection, final
DatabaseType databaseType) {
if (projection instanceof AggregationDistinctProjection) {
- boolean isPostgreSQLOpenGaussStatement = databaseType instanceof
PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType;
- return isPostgreSQLOpenGaussStatement ?
((AggregationDistinctProjection) projection).getType().name().toLowerCase() :
projection.getExpression();
+ return databaseType instanceof SchemaSupportedDatabaseType ?
((AggregationDistinctProjection) projection).getType().name().toLowerCase() :
projection.getExpression();
}
return projection.getColumnLabel();
}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
index ca4546d874a..cf8253f298e 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mode.metadata;
import lombok.Getter;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.data.ShardingSphereData;
import
org.apache.shardingsphere.infra.metadata.data.ShardingSphereDatabaseData;
@@ -55,8 +55,8 @@ public final class MetaDataContexts implements AutoCloseable {
return new ShardingSphereData();
}
ShardingSphereData result =
Optional.ofNullable(metaData.getDatabases().values().iterator().next().getProtocolType())
- // TODO can `protocolType instanceof OpenGaussDatabaseType ?
"PostgreSQL" : protocolType.getType()` replace to trunk database type?
- .flatMap(protocolType ->
TypedSPILoader.findService(ShardingSphereDataBuilder.class, protocolType
instanceof OpenGaussDatabaseType ? "PostgreSQL" : protocolType.getType())
+ // TODO can `protocolType instanceof
SchemaSupportedDatabaseType ? "PostgreSQL" : protocolType.getType()` replace to
trunk database type?
+ .flatMap(protocolType ->
TypedSPILoader.findService(ShardingSphereDataBuilder.class, protocolType
instanceof SchemaSupportedDatabaseType ? "PostgreSQL" : protocolType.getType())
.map(builder -> builder.build(metaData)))
.orElseGet(ShardingSphereData::new);
Optional<ShardingSphereData> loadedShardingSphereData =
Optional.ofNullable(persistService.getShardingSphereDataPersistService())
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
index 64020dc89f0..b3932087339 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
@@ -18,9 +18,8 @@
package org.apache.shardingsphere.proxy.backend.handler.transaction;
import
org.apache.shardingsphere.dialect.exception.transaction.InTransactionException;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import
org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.proxy.backend.connector.TransactionManager;
import
org.apache.shardingsphere.proxy.backend.connector.jdbc.transaction.BackendTransactionManager;
@@ -99,7 +98,7 @@ public final class TransactionBackendHandler implements
ProxyBackendHandler {
if (connectionSession.getTransactionStatus().isInTransaction()) {
if (connectionSession.getProtocolType() instanceof
MySQLDatabaseType) {
backendTransactionManager.commit();
- } else if (connectionSession.getProtocolType() instanceof
PostgreSQLDatabaseType || connectionSession.getProtocolType() instanceof
OpenGaussDatabaseType) {
+ } else if (isSchemaSupportedDatabaseType()) {
throw new InTransactionException();
}
}
@@ -107,25 +106,25 @@ public final class TransactionBackendHandler implements
ProxyBackendHandler {
}
private void handleSavepoint() throws SQLException {
-
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isPostgreSQLOrOpenGauss(),
+
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isSchemaSupportedDatabaseType(),
() -> new SQLFeatureNotSupportedException("SAVEPOINT can only
be used in transaction blocks"));
backendTransactionManager.setSavepoint(((SavepointStatement)
tclStatement).getSavepointName());
}
private void handleRollbackToSavepoint() throws SQLException {
-
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isPostgreSQLOrOpenGauss(),
+
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isSchemaSupportedDatabaseType(),
() -> new SQLFeatureNotSupportedException("ROLLBACK TO
SAVEPOINT can only be used in transaction blocks"));
backendTransactionManager.rollbackTo(((RollbackStatement)
tclStatement).getSavepointName().get());
}
private void handleReleaseSavepoint() throws SQLException {
-
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isPostgreSQLOrOpenGauss(),
+
ShardingSpherePreconditions.checkState(connectionSession.getTransactionStatus().isInTransaction()
|| !isSchemaSupportedDatabaseType(),
() -> new SQLFeatureNotSupportedException("RELEASE SAVEPOINT
can only be used in transaction blocks"));
backendTransactionManager.releaseSavepoint(((ReleaseSavepointStatement)
tclStatement).getSavepointName());
}
- private boolean isPostgreSQLOrOpenGauss() {
- return connectionSession.getProtocolType() instanceof
PostgreSQLDatabaseType || connectionSession.getProtocolType() instanceof
OpenGaussDatabaseType;
+ private boolean isSchemaSupportedDatabaseType() {
+ return connectionSession.getProtocolType() instanceof
SchemaSupportedDatabaseType;
}
private SQLStatement getSQLStatementByCommit() {
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
index 0c48b17f3ed..7298b116ef0 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
@@ -20,9 +20,8 @@ package
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.base.BaseIncrementTask;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
@@ -89,7 +88,7 @@ public final class E2EIncrementalTask extends
BaseIncrementTask {
String sql;
if (databaseType instanceof MySQLDatabaseType) {
sql = SQLBuilderUtils.buildInsertSQL(MYSQL_COLUMN_NAMES,
orderTableName);
- } else if (databaseType instanceof PostgreSQLDatabaseType ||
databaseType instanceof OpenGaussDatabaseType) {
+ } else if (databaseType instanceof SchemaSupportedDatabaseType) {
sql = SQLBuilderUtils.buildInsertSQL(POSTGRESQL_COLUMN_NAMES,
orderTableName);
} else {
throw new UnsupportedOperationException();
@@ -110,7 +109,7 @@ public final class E2EIncrementalTask extends
BaseIncrementTask {
"D".getBytes(), "A".getBytes(), "T".getBytes(), "E",
"text", "mediumText", "3", "3", PipelineCaseHelper.generateJsonString(32,
true), orderId});
return;
}
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType
instanceof OpenGaussDatabaseType) {
+ if (databaseType instanceof SchemaSupportedDatabaseType) {
String sql =
SQLBuilderUtils.buildUpdateSQL(ignoreShardingColumns(POSTGRESQL_COLUMN_NAMES),
orderTableName, "?");
log.info("update sql: {}", sql);
DataSourceExecuteUtils.execute(dataSource, sql, new
Object[]{"中文测试", randomInt, BigDecimal.valueOf(10000), true, new byte[]{},
"char", "varchar", PipelineCaseHelper.generateFloat(),
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
index f0709ec4ca2..937e8c7b279 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
@@ -22,9 +22,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.AutoIncrementKeyGenerateAlgorithm;
@@ -89,7 +88,7 @@ public final class PipelineCaseHelper {
}
return result;
}
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType
instanceof OpenGaussDatabaseType) {
+ if (databaseType instanceof SchemaSupportedDatabaseType) {
for (int i = 0; i < insertRows; i++) {
Object orderId = keyGenerateAlgorithm.generateKey();
result.add(new Object[]{orderId, generateInt(0, 100),
generateString(6), generateInt(-128, 127),