mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
e4d3595b18
In 5.0 we made LOAD DATA INFILE autocommit in all engines, while only NDB wanted that. Users and trainers complained that it affected InnoDB and was a change compared to 4.1 where only NDB autocommitted. To revert to the behaviour of 4.1, we move the autocommit logic out of mysql_load() into ha_ndbcluster::external_lock(). The result is that LOAD DATA INFILE commits all uncommitted changes of NDB if this is an NDB table, its own changes if this is an NDB table, but does not affect other engines. Note: even though there is no "commit the full transaction at end" anymore, LOAD DATA INFILE stays disabled in routines (re-entrency problems per a comment of Pem). Note: ha_ndbcluster::has_transactions() does not give reliable results because it says "yes" even if transactions are disabled in this engine...
66 lines
1.5 KiB
Text
66 lines
1.5 KiB
Text
# Test of a transaction mixing the two engines
|
|
|
|
-- source include/have_ndb.inc
|
|
-- source include/have_innodb.inc
|
|
-- source include/master-slave.inc
|
|
|
|
create table t1 (a int, unique(a)) engine=ndbcluster;
|
|
create table t2 (a int, unique(a)) engine=innodb;
|
|
|
|
|
|
begin;
|
|
insert into t1 values(1);
|
|
insert into t2 values(1);
|
|
rollback;
|
|
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
sync_slave_with_master;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
connection master;
|
|
|
|
begin;
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
|
rollback;
|
|
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
sync_slave_with_master;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
connection master;
|
|
|
|
delete from t1;
|
|
delete from t2;
|
|
begin;
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
|
rollback;
|
|
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
sync_slave_with_master;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
connection master;
|
|
|
|
delete from t1;
|
|
delete from t2;
|
|
begin;
|
|
insert into t2 values(3),(4);
|
|
insert into t1 values(3),(4);
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
|
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
|
rollback;
|
|
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
sync_slave_with_master;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
connection master;
|
|
|
|
drop table t1,t2;
|
|
sync_slave_with_master;
|