Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor DriverExecutor #31519

Merged
merged 3 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/document/content/features/transaction/_index.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ BASE 是基本可用、柔性状态和最终一致性这三个要素的缩写。
Apache ShardingSphere 集成了 SEATA 作为柔性事务的使用方案。
可通过下表详细对比它们之间的区别,以帮助开发者进行技术选型。

| | *LOCAL* | *XA* | *BASE* |
| -------- | ------------- | ---------------- | ------------ |
| 业务改造 | 无 | 无 | 需要 seata server|
| 一致性 | 不支持 | 支持 | 最终一致 |
| 隔离性 | 不支持 | 支持 | 业务方保证 |
| 并发性能 | 无影响 | 严重衰退 | 略微衰退 |
| 适合场景 | 业务方处理不一致 | 短事务 & 低并发 | 长事务 & 高并发 |
| | *LOCAL* | *XA* | *BASE* |
|------|----------|-----------|-----------------|
| 业务改造 | 无 | 无 | 需要 Seata Server |
| 一致性 | 不支持 | 支持 | 最终一致 |
| 隔离性 | 不支持 | 支持 | 业务方保证 |
| 并发性能 | 无影响 | 严重衰退 | 略微衰退 |
| 适合场景 | 业务方处理不一致 | 短事务 & 低并发 | 长事务 & 高并发 |

## 应用场景

Expand Down
14 changes: 7 additions & 7 deletions docs/document/content/features/transaction/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ private List<ResultSet> getResultSets() throws SQLException {
public int executeUpdate(final ShardingSphereMetaData metaData, final ShardingSphereDatabase database, final QueryContext queryContext,
final DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> prepareEngine, final TrafficExecutorCallback<Integer> trafficCallback,
final ExecuteUpdateCallback updateCallback, final StatementReplayCallback statementReplayCallback) throws SQLException {
ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext);
Optional<String> 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()));
}

Expand Down
Loading