1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with MySQL 5.1.53

Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
 - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 
- Werror is disabled;  Should be enabled after merge with xtradb.
This commit is contained in:
Michael Widenius
2010-11-25 00:57:34 +02:00
184 changed files with 6265 additions and 731 deletions

View File

@ -19,3 +19,23 @@ select * from mysqltest.t3;
n
45
drop database mysqltest;
# BUG#56226 Table map set to 0 after altering MyISAM table
SET SESSION binlog_format='ROW';
USE test;
CREATE TABLE t1 (a INT, b INT) ENGINE MyISAM;
CREATE TABLE t2 (a VARCHAR(255), b VARCHAR(255)) ENGINE MyISAM;
CREATE TRIGGER trg_t1ai
AFTER INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 (a) VALUES (NEW.a);
END;//
ALTER TABLE t1 CHANGE b c INT;
ALTER TABLE t2 CHANGE b c VARCHAR(255);
INSERT INTO t1 (a) VALUES(2);
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.t2 and slave:test.t2
DROP TABLE t1, t2;

View File

@ -4,6 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
@ -15,11 +17,14 @@ Got one of the listed errors
*** Single statement on non-transactional table ***
*** After WL#2687 the difference between STATEMENT/MIXED and ROW will not exist. ***
Got one of the listed errors
--source include/wait_for_slave_sql_error_and_skip.inc
include/start_slave.inc
*** Single statement on both transactional and non-transactional tables. ***
*** After WL#2687 we will be able to change the order of the tables. ***
Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
--source include/wait_for_slave_sql_error_and_skip.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
TRUNCATE TABLE t3;
@ -116,6 +121,37 @@ COMMIT;
BEGIN;
Got one of the listed errors
COMMIT;
--source include/wait_for_slave_sql_error_and_skip.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
########################################################################
# 8 - Bug#55375(Regression Bug) Transaction bigger than
# max_binlog_cache_size crashes slave
########################################################################
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
include/stop_slave.inc
include/start_slave.inc
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
TRUNCATE t1;
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
BEGIN;
Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
COMMIT;
SELECT count(*) FROM t1;
count(*)
0
show binlog events in 'slave-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
include/stop_slave.inc
include/start_slave.inc
SELECT count(*) FROM t1;
count(*)
128
########################################################################################
# CLEAN
########################################################################################
@ -126,10 +162,3 @@ DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1;

View File

@ -261,4 +261,27 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
DROP USER foo@"1.2.3.4";
# Bug#27606 GRANT statement should be replicated with DEFINER information
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
Grantor
root@localhost
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
Grantor
root@localhost
REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
Grantor
root@localhost
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
Grantor
root@localhost
DROP USER user_bug27606@localhost;
"End of test"

View File

@ -0,0 +1,127 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
# BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
#
# If a temporary table is created or dropped, the transaction should be
# regarded similarly that a non-transactional table is modified. So
# STOP SLAVE should wait until the transaction has finished.
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
SET DEBUG_SYNC= 'RESET';
include/stop_slave.inc
# Suspend the INSERT statement in current transaction on SQL thread.
# It guarantees that SQL thread is applying the transaction when
# STOP SLAVE command launchs.
SET GLOBAL debug= 'd,after_mysql_insert';
include/start_slave.inc
# CREATE TEMPORARY TABLE with InnoDB engine
# -----------------------------------------
[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
[ On Slave ]
STOP SLAVE SQL_THREAD;
[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'RESET';
[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;
# CREATE TEMPORARY TABLE with MyISAM engine
# -----------------------------------------
[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
[ On Slave ]
STOP SLAVE SQL_THREAD;
[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'RESET';
[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;
# CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
# ----------------------------------------------------
[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
SELECT c1 FROM t2;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
[ On Slave ]
STOP SLAVE SQL_THREAD;
[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'RESET';
[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;
# CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
# ----------------------------------------------------
[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
SELECT 1 AS c1;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
[ On Slave ]
STOP SLAVE SQL_THREAD;
[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'RESET';
[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;
# Test end
SET GLOBAL debug= '$debug_save';
DROP TABLE t1, t2;

View File

@ -69,3 +69,47 @@ slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 # Query # # use `test`; DROP TABLE t3, t1
# Bug#55478 Row events wrongly apply on the temporary table of the same name
# ==========================================================================
# The statement should be binlogged
CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
# Case 1: CREATE TABLE t1 ... SELECT
# ----------------------------------
# The statement generates row events on t1. And the rows events should
# be inserted into the base table on slave.
CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
`rand()` double NOT NULL DEFAULT '0'
) ENGINE=MyISAM
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
# Case 2: DROP TEMPORARY TABLE in a transacation(happens only on 5.5+)
# --------------------------------------------------------------------
BEGIN;
DROP TEMPORARY TABLE t1;
# The statement will binlogged after 'DROP TEMPORARY TABLE t1'
INSERT INTO t1 VALUES(1);
# The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
INSERT INTO t1 VALUES(uuid()+0);
COMMIT;
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
# Compare the base table.
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;

View File

@ -10,15 +10,62 @@ insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from mysqltest.t2;
select * from mysqltest.t3;
connection master;
drop database mysqltest;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
--echo
--echo # BUG#56226 Table map set to 0 after altering MyISAM table
--echo
connection master;
SET SESSION binlog_format='ROW';
USE test;
CREATE TABLE t1 (a INT, b INT) ENGINE MyISAM;
CREATE TABLE t2 (a VARCHAR(255), b VARCHAR(255)) ENGINE MyISAM;
--delimiter //
CREATE TRIGGER trg_t1ai
AFTER INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 (a) VALUES (NEW.a);
END;//
--delimiter ;
ALTER TABLE t1 CHANGE b c INT;
ALTER TABLE t2 CHANGE b c VARCHAR(255);
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
INSERT INTO t1 (a) VALUES(2);
let _info= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start, Info, 2);
# Table map id should not be 0.
if (`SELECT 'table_id: 0 (test.t1)' = '$_info'`)
{
--echo test.t1's table map id is 0;
--die test.t1's table map id is 0;
}
let _info= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start, Info, 3);
if (`SELECT 'table_id: 0 (test.t2)' = '$_info'`)
{
--echo test.t2's table map id is 0;
--die test.t2's table map id is 0;
}
let diff_table= test.t1;
source include/rpl_diff_tables.inc;
let diff_table= test.t2;
source include/rpl_diff_tables.inc;
--echo
connection master;
DROP TABLE t1, t2;
source include/master-slave-end.inc;
# End of 4.1 tests

View File

@ -1 +0,0 @@
--binlog_cache_size=4096 --max_binlog_cache_size=7680

View File

@ -30,6 +30,16 @@
--source include/not_embedded.inc
--source include/not_windows.inc
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
SET GLOBAL max_binlog_cache_size = 4096;
# Becuase of bug#55377, we have to set binlog_cache_size until the bug is
# fixed.
SET GLOBAL binlog_cache_size = 4096;
disconnect master;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
@ -57,25 +67,23 @@ if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
# Below code fakes the result of 'ROW' mode.
--echo Got one of the listed errors
--echo --source include/wait_for_slave_sql_error_and_skip.inc
--echo include/start_slave.inc
}
if (`SELECT @@binlog_format = 'ROW'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
--source include/wait_for_slave_sql_to_start.inc
# Incident event
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error_and_skip.inc
}
--enable_warnings
--enable_query_log
connection master;
--disable_query_log
eval INSERT INTO t1 (a, data) VALUES (3, $data);
eval INSERT INTO t1 (a, data) VALUES (4, $data);
@ -93,11 +101,9 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
t1.data = CONCAT($data, $data, $data, $data);
--enable_query_log
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
--source include/wait_for_slave_sql_to_start.inc
# Incident event
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error_and_skip.inc
#--echo ########################################################################################
#--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
@ -368,8 +374,70 @@ BEGIN;
--enable_query_log
COMMIT;
# Incident event
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error_and_skip.inc
sync_slave_with_master;
--echo ########################################################################
--echo # 8 - Bug#55375(Regression Bug) Transaction bigger than
--echo # max_binlog_cache_size crashes slave
--echo ########################################################################
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
source include/stop_slave.inc;
source include/start_slave.inc;
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
connection master;
TRUNCATE t1;
sync_slave_with_master;
--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
--let binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
connection master;
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
disconnect master;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
--let $n=128
BEGIN;
--disable_query_log
--echo Repeat statement 'INSERT INTO t1 VALUES(\$n, repeat("a", 32))' $n times
while ($n)
{
--eval INSERT INTO t1 VALUES ($n, repeat("a", 32))
--dec $n
}
--enable_query_log
COMMIT;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--let $slave_sql_errno= 1197
source include/wait_for_slave_sql_error.inc;
SELECT count(*) FROM t1;
source include/show_binlog_events.inc;
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
source include/stop_slave.inc;
source include/start_slave.inc;
connection master;
sync_slave_with_master;
SELECT count(*) FROM t1;
--echo ########################################################################################
--echo # CLEAN
@ -384,12 +452,5 @@ DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1;
connection slave;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1;
--enable_warnings
source include/master-slave-end.inc;

View File

@ -362,4 +362,25 @@ revoke all privileges, grant option from "foo";
DROP USER foo@"1.2.3.4";
-- sync_slave_with_master
--echo
--echo # Bug#27606 GRANT statement should be replicated with DEFINER information
--connection master
--source include/master-slave-reset.inc
--connection master
GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
sync_slave_with_master;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
--connection master
REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
sync_slave_with_master;
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
--connection master
DROP USER user_bug27606@localhost;
--source include/master-slave-end.inc
--echo "End of test"

View File

@ -122,7 +122,7 @@ echo [on master];
# This will block the execution of a statement at the DBUG_SYNC_POINT
# with given lock name
if (`SELECT '$debug_lock' != ''`)
if ($debug_lock)
{
disable_query_log;
disable_result_log;

View File

@ -0,0 +1,60 @@
source include/master-slave.inc;
source include/have_innodb.inc;
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/have_binlog_format_mixed_or_statement.inc;
--echo
--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
--echo #
--echo # If a temporary table is created or dropped, the transaction should be
--echo # regarded similarly that a non-transactional table is modified. So
--echo # STOP SLAVE should wait until the transaction has finished.
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
sync_slave_with_master;
SET DEBUG_SYNC= 'RESET';
source include/stop_slave.inc;
--echo
--echo # Suspend the INSERT statement in current transaction on SQL thread.
--echo # It guarantees that SQL thread is applying the transaction when
--echo # STOP SLAVE command launchs.
let $debug_save= `SELECT @@GLOBAL.debug`;
SET GLOBAL debug= 'd,after_mysql_insert';
source include/start_slave.inc;
--echo
--echo # CREATE TEMPORARY TABLE with InnoDB engine
--echo # -----------------------------------------
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
source extra/rpl_tests/rpl_stop_slave.test;
--echo
--echo # CREATE TEMPORARY TABLE with MyISAM engine
--echo # -----------------------------------------
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
source extra/rpl_tests/rpl_stop_slave.test;
--echo
--echo # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
--echo # ----------------------------------------------------
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
SELECT c1 FROM t2;
source extra/rpl_tests/rpl_stop_slave.test;
--echo
--echo # CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
--echo # ----------------------------------------------------
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
SELECT 1 AS c1;
source extra/rpl_tests/rpl_stop_slave.test;
--echo # Test end
SET GLOBAL debug= '$debug_save';
connection master;
DROP TABLE t1, t2;
source include/master-slave-end.inc;

View File

@ -11,6 +11,7 @@
source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;
source include/have_innodb.inc;
--echo ==== Initialize ====
@ -146,3 +147,55 @@ DROP TABLE t3, t1;
-- sync_slave_with_master
-- source include/show_binlog_events.inc
--echo
--echo # Bug#55478 Row events wrongly apply on the temporary table of the same name
--echo # ==========================================================================
connection master;
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo # The statement should be binlogged
CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
--echo
--echo # Case 1: CREATE TABLE t1 ... SELECT
--echo # ----------------------------------
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # The statement generates row events on t1. And the rows events should
--echo # be inserted into the base table on slave.
CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
source include/show_binlog_events.inc;
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Case 2: DROP TEMPORARY TABLE in a transacation(happens only on 5.5+)
--echo # --------------------------------------------------------------------
--echo
BEGIN;
DROP TEMPORARY TABLE t1;
--echo # The statement will binlogged after 'DROP TEMPORARY TABLE t1'
INSERT INTO t1 VALUES(1);
--echo # The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
INSERT INTO t1 VALUES(uuid()+0);
COMMIT;
source include/show_binlog_events.inc;
--echo # Compare the base table.
let diff_table= test.t1;
source include/rpl_diff_tables.inc;
--echo
connection master;
DROP TABLE t1;
source include/master-slave-end.inc;