Open zzbl1145141919 opened 8 months ago
Hi @zzbl1145141919
Have you start the transaction through begin;
?
Hi @zzbl1145141919 Have you start the transaction through
begin;
?
HI i'm sure i use transaction:
this is original table 'user':
this is my script:
START TRANSACTION;
update user set name= 'yeey' where id = 1;
rollback;
since we rollback, we should't see ANY "yeey" in user table;
but....
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Sorry I'm late, I will check this issue.
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
sharding proxy 's local transaction did't work....
Bug Report Which version of ShardingSphere did you use? Sharding-proxy 5.4.1 , the version of mysql is 8.0.33
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? Sharding-proxy
Expected behavior we have three basic tables: sharding key is age
CREATE TABLE
t_order_0
(id
int NOT NULL,name
varchar(50) DEFAULT NULL,age
int DEFAULT NULL, PRIMARY KEY (id
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;CREATE TABLE
t_order_1
(id
int NOT NULL,name
varchar(50) DEFAULT NULL,age
int DEFAULT NULL, PRIMARY KEY (id
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;CREATE TABLE
t_order_2
(id
int NOT NULL,name
varchar(50) DEFAULT NULL,age
int DEFAULT NULL, PRIMARY KEY (id
), UNIQUE KEYname_UNIQUE
(name
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;notice that t_order_2 has UNIQUE KEY (
name
)we input some data into there tables : INSERT INTO
p
.t_order_1
(id
,name
,age
) VALUES (1, 'a', 1);INSERT INTO
p
.t_order_2
(id
,name
,age
) VALUES (2, 'b', 2);INSERT INTO
p
.t_order_2
(id
,name
,age
) VALUES (3, 'bb', 5);then we exec this sql : update user set name = 'c' where age in (1,2,5)
Actual behavior
I'm expecting: due to the UNIQUE KEY on t_order_2, this whole update will fail
Actually, the operation to the t_order_2 failed, but the t_order_1 succeccfully updated:
you can see this line updated without having any rollback
you can see these updates are all executed by the same connection:![image](https://github.com/apache/shardingsphere/assets/133546527/b728f597-eee4-4a7c-a910-a218ede0c18a)
Settings:
server.yaml:
mode: type: Standalone # 单机模式
authority: users:
transaction: defaultType: LOCAL
props: sql-show: true max-connections-size-per-query: 1 proxy-mysql-default-version: 8.0.23 proxy-transaction-enabled: true
config-sharding.yaml:
schemaName: hmms
dataSources: hmms: url: jdbc:mysql://127.0.0.1:8306/p?serverTimezone=UTC&useSSL=false username: root password: root connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1
rules: