Commit d2dc70dc authored by unknown's avatar unknown

Testcase for BUG#20633 "INSERT DELAYED RAND() or @user_var does not replicate

statement-based" (bugfix was committed today):
we verify that now it works in mixed mode. And a comment.


mysql-test/r/rpl_switch_stm_row_mixed.result:
  result update
mysql-test/t/rpl_switch_stm_row_mixed.test:
  testcase for BUG#20633
sql/sql_insert.cc:
  the #ifdef was not necessary; a comment.
parent 94b92361
......@@ -150,6 +150,10 @@ insert delayed into t2 values("delay_3_"),(concat("delay_4_",UUID())),("delay_5_
Warnings:
Warning 1265 Data truncated for column 'UUID()' at row 2
insert delayed into t2 values("delay_6_");
create table t12 (a int, b float);
insert delayed into t12 values(1,rand());
set @a=2.345;
insert delayed into t12 values(2,@a);
select count(*) from t1;
count(*)
36
......@@ -165,6 +169,9 @@ count(*)
select count(*) from t5;
count(*)
58
select count(*) from t12;
count(*)
2
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest1
......@@ -279,4 +286,9 @@ master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 (a int, b float)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
drop database mysqltest1;
......@@ -154,12 +154,21 @@ call foo2();
select foo3();
select * from t1 where a="alarm";
# Test that INSERT DELAYED works in mixed mode
# Test that INSERT DELAYED works in mixed mode (BUG#20649)
insert delayed into t2 values("delay_1_");
insert delayed into t2 values(concat("delay_2_",UUID()));
insert delayed into t2 values("delay_3_"),(concat("delay_4_",UUID())),("delay_5_");
insert delayed into t2 values("delay_6_");
sleep 4; # time for the delayed insert to reach disk
# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
# replicate fine in statement-based ; we test that in mixed mode it
# works).
create table t12 (a int, b float);
insert delayed into t12 values(1,rand());
set @a=2.345;
insert delayed into t12 values(2,@a);
sleep 4; # time for the delayed inserts to reach disk
# If you want to do manual testing of the mixed mode regarding UDFs (not
# testable automatically as quite platform- and compiler-dependent),
......@@ -195,6 +204,7 @@ select count(*) from t2;
select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select count(*) from t12;
if ($you_want_to_test_UDF)
{
select count(*) from t6;
......
......@@ -1290,9 +1290,11 @@ class delayed_insert :public ilink {
thd.command=COM_DELAYED_INSERT;
thd.lex->current_select= 0; // for my_message_sql
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
#ifdef HAVE_ROW_BASED_REPLICATION
/*
Statement-based replication of INSERT DELAYED has problems with RAND()
and user vars, so in mixed mode we go to row-based.
*/
thd.set_current_stmt_binlog_row_based_if_mixed();
#endif
bzero((char*) &thd.net, sizeof(thd.net)); // Safety
bzero((char*) &table_list, sizeof(table_list)); // Safety
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment