mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
"BUG #18764: Delete conditions causing inconsistencies in Federated tables"
Removed logic in ha_federated::write_row, which checks field query ids in the loop which builds the query to run on the remote server. mysql-test/r/federated.result: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" New test results for test that verifies that one can insert to rows using "insert into... select * from..", delete them by id, then immediately insert them in the same way they were originally inserted. mysql-test/t/federated.test: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" New test that verifies that one can insert to rows using "insert into... select * from..", delete them by id, then immediately insert them in the same way they were originally inserted. sql/ha_federated.cc: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" Removed the logic in ha_federated::write_row which checked the query id of each field and compared it to the thread query id. Each field has a query id, and the problem used to be that if I did an insert no fields specified, the field value would contain the last inserted value for that field. The way to work around this was to see if the query id for that field was the same as the current query id or of the rest of the field query ids. If it wasn't, that told me the query didn't have the field value specified. Somewhere from when I wrote that code to now the problem went away, and there was no longer the need for this logic. Also removed the bool "has_fields", which needs not exist and using table->s->fields is sufficient.
This commit is contained in:
@ -1689,6 +1689,44 @@ id c1 c2
|
||||
9 abc ppc
|
||||
drop table federated.t1, federated.t2;
|
||||
drop table federated.t1, federated.t2;
|
||||
DROP TABLE IF EXISTS federated.test;
|
||||
CREATE TABLE federated.test (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
DROP TABLE IF EXISTS federated.test_local;
|
||||
DROP TABLE IF EXISTS federated.test_remote;
|
||||
CREATE TABLE federated.test_local (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
|
||||
(2, 'bar', 'foo');
|
||||
CREATE TABLE federated.test_remote (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
|
||||
insert into federated.test_remote select * from federated.test_local;
|
||||
select * from federated.test_remote;
|
||||
id val1 val2
|
||||
1 foo bar
|
||||
2 bar foo
|
||||
delete from federated.test_remote where id in (1,2);
|
||||
insert into federated.test_remote select * from federated.test_local;
|
||||
select * from federated.test_remote;
|
||||
id val1 val2
|
||||
2 bar foo
|
||||
1 foo bar
|
||||
DROP TABLE federated.test_local;
|
||||
DROP TABLE federated.test_remote;
|
||||
DROP TABLE federated.test;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
|
@ -1365,4 +1365,61 @@ drop table federated.t1, federated.t2;
|
||||
connection slave;
|
||||
drop table federated.t1, federated.t2;
|
||||
|
||||
#
|
||||
# BUG #18764: Delete conditions causing inconsistencies in Federated tables
|
||||
#
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.test;
|
||||
--enable_warnings
|
||||
CREATE TABLE federated.test (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.test_local;
|
||||
DROP TABLE IF EXISTS federated.test_remote;
|
||||
--enable_warnings
|
||||
CREATE TABLE federated.test_local (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
|
||||
(2, 'bar', 'foo');
|
||||
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.test_remote (
|
||||
`id` int(11) NOT NULL,
|
||||
`val1` varchar(255) NOT NULL,
|
||||
`val2` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
|
||||
|
||||
insert into federated.test_remote select * from federated.test_local;
|
||||
|
||||
select * from federated.test_remote;
|
||||
|
||||
delete from federated.test_remote where id in (1,2);
|
||||
|
||||
insert into federated.test_remote select * from federated.test_local;
|
||||
|
||||
select * from federated.test_remote;
|
||||
--disable_warnings
|
||||
DROP TABLE federated.test_local;
|
||||
DROP TABLE federated.test_remote;
|
||||
--enable_warnings
|
||||
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
DROP TABLE federated.test;
|
||||
--enable_warnings
|
||||
|
||||
source include/federated_cleanup.inc;
|
||||
|
Reference in New Issue
Block a user