mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
dba70720a7
"Federared Transactions Failure" Bug occurs when the user performs an operation which inserts more than one row into the federated table and the federated table references a remote table stored within a transactional storage engine. When the insert operation for any one row in the statement fails due to constraint violation, the federated engine is unable to perform statement rollback and so the remote table contains a partial commit. The user would expect a statement to perform the same so a statement rollback is expected. This bug was fixed by implementing bulk-insert handling into the federated storage engine. This will relieve the bug for most common situations by enabling the generation of a multi-row insert into the remote table and thus permitting the remote table to perform statement rollback when neccessary. The multi-row insert is limited to the maximum packet size between servers and should the size overflow, more than one insert statement will be sent and this bug will reappear. Multi-row insert is disabled when an "INSERT...ON DUPLICATE KEY UPDATE" is being performed. The bulk-insert handling will offer a significant performance boost when inserting a large number of small rows. This patch builds on Bug29019 and Bug25511 sql/ha_federated.cc: bug25513 new member methods: start_bulk_insert() - initializes memory for bulk insert end_bulk_insert() - sends any remaining bulk insert and frees memory append_stmt_insert() - create the INSERT statement sql/ha_federated.h: bug25513 new member value: bulk_insert new member methods: start_bulk_insert(), end_bulk_insert(), append_stmt_insert() make member methods private: read_next(), index_read_idx_with_result_set() mysql-test/r/federated_innodb.result: New BitKeeper file ``mysql-test/r/federated_innodb.result'' mysql-test/t/federated_innodb-slave.opt: New BitKeeper file ``mysql-test/t/federated_innodb-slave.opt'' mysql-test/t/federated_innodb.test: New BitKeeper file ``mysql-test/t/federated_innodb.test''
34 lines
862 B
Text
34 lines
862 B
Text
source include/federated.inc;
|
|
source include/have_innodb.inc;
|
|
|
|
#
|
|
# Bug#25513 Federated transaction failures
|
|
#
|
|
connection slave;
|
|
create table federated.t1 (a int primary key, b varchar(64))
|
|
engine=myisam;
|
|
connection master;
|
|
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
|
eval create table federated.t1 (a int primary key, b varchar(64))
|
|
engine=federated
|
|
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
|
|
|
|
--error ER_DUP_KEY
|
|
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
|
select * from federated.t1;
|
|
|
|
connection slave;
|
|
truncate federated.t1;
|
|
alter table federated.t1 engine=innodb;
|
|
connection master;
|
|
|
|
--error ER_DUP_KEY
|
|
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
|
select * from federated.t1;
|
|
|
|
drop table federated.t1;
|
|
connection slave;
|
|
drop table federated.t1;
|
|
|
|
|
|
source include/federated_cleanup.inc;
|