未验证 提交 35d39da2 编写于 作者: F fuxiang 提交者: GitHub

fix(core): fixed crash caused by using transaction statements(#417) (#418)

* fix(core): fixed crash caused by using transaction statements

* fix(core): fixed crash caused by using transaction statements, update mtr
Co-authored-by: Nmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
上级 af5118b4
use test;
show variables like 'tianmu_insert_delayed';
Variable_name Value
tianmu_insert_delayed OFF
CREATE TABLE `t_test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(10) NOT NULL,
`last_name` varchar(10) NOT NULL,
`sex` varchar(5) NOT NULL,
`score` int(11) NOT NULL,
`copy_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4;
BEGIN;
INSERT INTO t_test values(1,'jack1','rose1',0,56,0);
COMMIT;
SELECT id FROM t_test;
id
1
BEGIN;
INSERT INTO t_test values(2,'tom','jerry',1,57,0);
ROLLBACK;
SELECT id FROM t_test;
id
1
2
DROP TABLE t_test;
--tianmu_insert_delayed=0
\ No newline at end of file
use test;
show variables like 'tianmu_insert_delayed';
CREATE TABLE `t_test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(10) NOT NULL,
`last_name` varchar(10) NOT NULL,
`sex` varchar(5) NOT NULL,
`score` int(11) NOT NULL,
`copy_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4;
BEGIN;
INSERT INTO t_test values(1,'jack1','rose1',0,56,0);
COMMIT;
SELECT id FROM t_test;
BEGIN;
INSERT INTO t_test values(2,'tom','jerry',1,57,0);
# Now `ROLLBACK` is not working, add this to ensure the test process is complete
ROLLBACK;
SELECT id FROM t_test;
DROP TABLE t_test;
......@@ -737,7 +737,6 @@ AttributeTypeInfo Engine::GetAttrTypeInfo(const Field &field) {
void Engine::CommitTx(THD *thd, bool all) {
if (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT)) {
GetTx(thd)->Commit(thd);
thd->server_status &= ~SERVER_STATUS_IN_TRANS;
}
ClearTx(thd);
}
......@@ -749,7 +748,6 @@ void Engine::Rollback(THD *thd, bool all, bool force_error_message) {
GetTx(thd)->Rollback(thd, force_error_message);
ClearTx(thd);
}
thd->server_status &= ~SERVER_STATUS_IN_TRANS;
thd->transaction_rollback_request = false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册