事务超时后的异常处理改进

ob-ce-4.0.0

ob [test]>set session ob_trx_timeout = 12000000;

ob [test]>begin;
Query OK, 0 rows affected (0.00 sec)
<--- 停顿超过12秒

ob [test]>insert into t1 select rand()*1024;
ERROR 4012 (25000): Transaction timeout occurred, please rollback the transaction, set the variable ob_trx_timeout to a larger value and then restart the transaction
ob [test]>select * from t1;
ERROR 4012 (25000): Transaction timeout occurred, please rollback the transaction, set the variable ob_trx_timeout to a larger value and then restart the transaction

ob [test]>commit;   <--手动执行commit,被强制当做rollback处理了,而不是继续报错
ERROR 6002 (40000): Transaction rollbacked

ob [test]>select * from t1;
Empty set (0.00 sec)

感谢您的反馈~我们会反馈给研发人员

事务超时时间设置的是12s,事务超时之后需要结束掉当前事务再开启新事务。

commit或者rollback请求都可以用来结束事务,commit将事务结束掉并且返回事务执行的最终结果Transaction rollbacked