Skip to content

Commit

Permalink
fix(tianmu):The myloader cann't work if the autocommit is closed. (st…
Browse files Browse the repository at this point in the history
…oneatom#1510)

Currently, TIANMU does not support manual transactions and only supports automatic commit.
However, it does determine whether to commit the transaction based on the automatic commit parameters of MySQL.
If automatic commit is turned off, automatic commit will not be performed on the transaction
  • Loading branch information
konghaiya committed Apr 4, 2023
1 parent 7484c58 commit 67cf1cd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mysql-test/suite/tianmu/r/issue1510.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DROP DATABASE IF EXISTS issue1510_test;
CREATE DATABASE issue1510_test;
USE issue1510_test;
create table ttt(id int primary key,name varchar(10));
begin;
insert into ttt values(1,'AAA');
commit;
select * from ttt;
id name
1 AAA
drop table ttt;
create table ttt(id int primary key,name varchar(10));
insert into ttt values(1,'AAA');
select * from ttt;
id name
1 AAA
drop table ttt;
DROP DATABASE issue1510_test;
1 change: 1 addition & 0 deletions mysql-test/suite/tianmu/t/issue1510-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--autocommit=0
23 changes: 23 additions & 0 deletions mysql-test/suite/tianmu/t/issue1510.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--source include/have_tianmu.inc

--disable_warnings
DROP DATABASE IF EXISTS issue1510_test;
--enable_warnings

CREATE DATABASE issue1510_test;

USE issue1510_test;

create table ttt(id int primary key,name varchar(10));
begin;
insert into ttt values(1,'AAA');
commit;
select * from ttt;
drop table ttt;

create table ttt(id int primary key,name varchar(10));
insert into ttt values(1,'AAA');
select * from ttt;
drop table ttt;

DROP DATABASE issue1510_test;
9 changes: 9 additions & 0 deletions storage/tianmu/core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,18 @@ AttributeTypeInfo Engine::GetAttrTypeInfo(const Field &field) {
}

void Engine::CommitTx(THD *thd, bool all) {
/*
Currently, the tianmu engine does not support manual transactions,
and there is a problem with the current determination of automatic commit.
After auto commit is turned off, tianmu will not commit the transaction.
Therefore, it is modified to the default automatic commit statement level transaction.
In the future, this logic will be modified after manual transactions are supported.
if (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT)) {
GetTx(thd)->Commit(thd);
}
*/
GetTx(thd)->Commit(thd);
ClearTx(thd);
}

Expand Down

0 comments on commit 67cf1cd

Please sign in to comment.