apache / apache/shardingsphere

Local transaction will be broken while max-connections-size-per-query greater than 1

Open
#21,099 8 comments 0 reactions 1 assignee Claimed by @FlyingZC View on GitHub
feature: transaction
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

## Bug Report

**For English only**, other languages will not accept.

Before report a bug, make sure you have:

- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.

Please answer these questions before submitting your issue. Thanks!

### Which version of ShardingSphere did you use?
- 5.1.0

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
- ShardingSphere-JDBC

### Expected behavior
- `DriverExecutionPrepareEngine` return one connection if statement in a local transaction

### Actual behavior
- `DriverExecutionPrepareEngine` return more than one connection if max-connections-size-per-query greater than 1

image

### Reason analyze (If you can)
- Absence of LocalTransactionManager

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
#### Demo project
- **repo url:** https://github.com/I-Love-China/shardingsphere
- **branch:** `comment-global`
- **main entry:** `org.apache.shardingsphere.shardingspheredemo.service.HealthRecordServiceTest#test`
- **DDL:** https://github.com/I-Love-China/shardingsphere/blob/comment-global/shardingsphere-demo/src/main/resources/sql/DDL.sql
- There will be a warning while running this unit test: `expected connections: 1, actual connections: 3`;

### Example codes for reproduce this issue (such as a github link).
image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.