From 5e2fb8ae622cc9626e1240d088f9e55082a725dc Mon Sep 17 00:00:00 2001 From: terrymanu Date: Sat, 1 Jun 2024 16:04:54 +0800 Subject: [PATCH 1/3] Fix table formats for docs --- .../content/features/transaction/_index.cn.md | 14 +++++++------- .../content/features/transaction/_index.en.md | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/document/content/features/transaction/_index.cn.md b/docs/document/content/features/transaction/_index.cn.md index 232623e60b15f..5592900583b89 100644 --- a/docs/document/content/features/transaction/_index.cn.md +++ b/docs/document/content/features/transaction/_index.cn.md @@ -74,13 +74,13 @@ BASE 是基本可用、柔性状态和最终一致性这三个要素的缩写。 Apache ShardingSphere 集成了 SEATA 作为柔性事务的使用方案。 可通过下表详细对比它们之间的区别,以帮助开发者进行技术选型。 -| | *LOCAL* | *XA* | *BASE* | -| -------- | ------------- | ---------------- | ------------ | -| 业务改造 | 无 | 无 | 需要 seata server| -| 一致性 | 不支持 | 支持 | 最终一致 | -| 隔离性 | 不支持 | 支持 | 业务方保证 | -| 并发性能 | 无影响 | 严重衰退 | 略微衰退 | -| 适合场景 | 业务方处理不一致 | 短事务 & 低并发 | 长事务 & 高并发 | +| | *LOCAL* | *XA* | *BASE* | +|------|----------|-----------|-----------------| +| 业务改造 | 无 | 无 | 需要 Seata Server | +| 一致性 | 不支持 | 支持 | 最终一致 | +| 隔离性 | 不支持 | 支持 | 业务方保证 | +| 并发性能 | 无影响 | 严重衰退 | 略微衰退 | +| 适合场景 | 业务方处理不一致 | 短事务 & 低并发 | 长事务 & 高并发 | ## 应用场景 diff --git a/docs/document/content/features/transaction/_index.en.md b/docs/document/content/features/transaction/_index.en.md index e7fe2f6f27b28..405df97eee4b1 100644 --- a/docs/document/content/features/transaction/_index.en.md +++ b/docs/document/content/features/transaction/_index.en.md @@ -73,13 +73,13 @@ ACID-based strong consistency transactions and BASE-based final consistency tran Apache ShardingSphere integrates the operational scheme taking SEATA as the flexible transaction. The following table can be used for comparison to help developers choose the suitable technology. -| | *LOCAL* | *XA* | *BASE* | -| -------- | ------------- | ---------------- | ------------ | -| Business transformation | None | None | Seata server needed| -| Consistency | Not supported | Supported | Final consistency | -| Isolation | Not supported | Supported | Business side guaranteed | -| Concurrent performance | no loss | severe loss | slight loss | -| Applied scenarios | Inconsistent processing by the business side | short transaction & low-level concurrency | long transaction & high concurrency | +| | *LOCAL* | *XA* | *BASE* | +|-------------------------|----------------------------------------------|-------------------------------------------|-------------------------------------| +| Business transformation | None | None | Seata Server needed | +| Consistency | Not supported | Supported | Final consistency | +| Isolation | Not supported | Supported | Business side guaranteed | +| Concurrent performance | no loss | severe loss | slight loss | +| Applied scenarios | Inconsistent processing by the business side | short transaction & low-level concurrency | long transaction & high concurrency | ## Application Scenarios From 3c608e24880825a74aa852d5c1eeeb9c77a04c41 Mon Sep 17 00:00:00 2001 From: terrymanu Date: Sat, 1 Jun 2024 21:48:40 +0800 Subject: [PATCH 2/3] Refactor DriverExecutor --- .../shardingsphere/driver/executor/DriverExecutor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java index 86cf6ff939964..a8dd45a89f869 100644 --- a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java +++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java @@ -272,15 +272,15 @@ private List getResultSets() throws SQLException { public int executeUpdate(final ShardingSphereMetaData metaData, final ShardingSphereDatabase database, final QueryContext queryContext, final DriverExecutionPrepareEngine prepareEngine, final TrafficExecutorCallback trafficCallback, final ExecuteUpdateCallback updateCallback, final StatementReplayCallback statementReplayCallback) throws SQLException { - ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext); Optional trafficInstanceId = connection.getTrafficInstanceId(metaData.getGlobalRuleMetaData().getSingleRule(TrafficRule.class), queryContext); if (trafficInstanceId.isPresent()) { return trafficExecutor.execute(connection.getProcessId(), database.getName(), trafficInstanceId.get(), queryContext, prepareEngine, trafficCallback); } - boolean isNeedImplicitCommitTransaction = isNeedImplicitCommitTransaction( - connection, queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1); + ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext); return database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty() - ? executeUpdate(database, updateCallback, queryContext.getSqlStatementContext(), executionContext, prepareEngine, isNeedImplicitCommitTransaction, statementReplayCallback) + ? executeUpdate(database, updateCallback, queryContext.getSqlStatementContext(), executionContext, prepareEngine, + isNeedImplicitCommitTransaction(connection, + queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1), statementReplayCallback) : accumulate(rawExecutor.execute(createRawExecutionGroupContext(metaData, database, executionContext), queryContext, new RawSQLExecutorCallback())); } From 8fbcedea6da83cbf19138d72d44e4458f57b9274 Mon Sep 17 00:00:00 2001 From: terrymanu Date: Sat, 1 Jun 2024 21:54:20 +0800 Subject: [PATCH 3/3] Refactor DriverExecutor --- .../shardingsphere/driver/executor/DriverExecutor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java index a8dd45a89f869..4ce0c23713fea 100644 --- a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java +++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java @@ -279,8 +279,9 @@ public int executeUpdate(final ShardingSphereMetaData metaData, final ShardingSp ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext); return database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty() ? executeUpdate(database, updateCallback, queryContext.getSqlStatementContext(), executionContext, prepareEngine, - isNeedImplicitCommitTransaction(connection, - queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1), statementReplayCallback) + isNeedImplicitCommitTransaction(connection, + queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1), + statementReplayCallback) : accumulate(rawExecutor.execute(createRawExecutionGroupContext(metaData, database, executionContext), queryContext, new RawSQLExecutorCallback())); }