MyCATApache / Mycat-Server

GNU General Public License v2.0
9.5k stars 3.85k forks source link

Mycat开启强一致性事务,但是好像没锁住,for update #2896

Open 3721518 opened 2 years ago

3721518 commented 2 years ago

1、bug描述 mycat日志:Release previous connection,can't be used in trasaction...... old shema=Fusyt, borrowed=true, fromSlaveDB=true, threadId=7748, charset=utf8, txIsolation=3, autocommit=true, txReadonly=false

2、版本号(非常重要) mycat-1.6.7.6-20211118

3、相关表的配置信息 schema.xml (native方式) server.xml(strictTxIsolation=true)

4、操作步骤 执行的MySQL语句:SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'MyScheduler' AND LOCK_NAME = 'TRIGGER_ACCESS' FOR UPDATE

4、需求 凡是sql有for update的全部走主库

junwen12221 commented 2 years ago

开启事务了吗

set autocommit =0; 然后操作

3721518 commented 2 years ago

开启事务了吗

set autocommit =0; 然后操作

MySQL默认autocommit = on,显示的指定那不就是手动给 set autocommit = 0。这种方法不灵活好像!!!

junwen12221 commented 2 years ago

for update在事务内才生效,发到了从节点也没有用