mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#5370 Keep forward-compatibility when changing
'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour BUG#55474, BUG#55499, BUG#55598, BUG#55616 and BUG#55777 are fixed in this patch too. This is the 5.1 part. It implements: - if the table exists, binlog two events: CREATE TABLE IF NOT EXISTS and INSERT ... SELECT - Insert nothing and binlog nothing on master if the existing object is a view. It only generates a warning that table already exists. mysql-test/r/trigger.result: Ather this patch, 'CREATE TABLE IF NOT EXISTS ... SELECT' will not insert anything if the creating table already exists and is a view. sql/sql_class.h: Declare virtual function write_to_binlog() for select_insert. It's used to binlog 'create select' sql/sql_insert.cc: Implement write_to_binlog(); Use write_to_binlog() instead of binlog_query() to binlog the statement. if the table exists, binlog two events: CREATE TABLE IF NOT EXISTS and INSERT ... SELECT sql/sql_lex.h: Declare create_select_start_with_brace and create_select_pos. They are helpful for binlogging 'create select' sql/sql_parse.cc: Do nothing on master if the existing object is a view. sql/sql_yacc.yy: Record the relative postion of 'SELECT' in the 'CREATE ...SELECT' statement. Record whether there is a '(' before the 'SELECT' clause.
This commit is contained in:
@ -119,5 +119,32 @@ SELECT * FROM t2;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo
|
||||
--echo # Bug#55616 Killing thread or query during CREATE IF NOT EXISTS makes
|
||||
--echo # slave SQL thread abort
|
||||
--echo
|
||||
|
||||
--connection master1
|
||||
let $con_id = `SELECT CONNECTION_ID()`;
|
||||
|
||||
CREATE TABLE t1 ( i INT );
|
||||
send CREATE TABLE IF NOT EXISTS t1
|
||||
AS SELECT SLEEP(3);
|
||||
|
||||
connection master;
|
||||
let $wait_timeout = 3;
|
||||
let $show_statement = SHOW PROCESSLIST;
|
||||
let $field = State;
|
||||
let $condition = = 'User sleep';
|
||||
source include/wait_show_condition.inc;
|
||||
|
||||
--replace_result $con_id master1
|
||||
eval KILL QUERY $con_id;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
source include/master-slave-end.inc;
|
||||
|
Reference in New Issue
Block a user