mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
4dc7be62a9
Problem: When RAND() is binlogged in statement mode, the seed is binlogged too, so the replication slave generates the same sequence of random numbers. This makes replication work in many cases, but not in all cases: the order of rows is not guaranteed for, e.g., UPDATE or INSERT...SELECT statements, so the row data will be different if master and slave retrieve the rows in different orders. Fix: Mark RAND() as unsafe. It will generate a warning if binlog_format=STATEMENT and switch to row-logging if binlog_format=ROW. mysql-test/extra/rpl_tests/rpl_row_func003.test: updated test case to ignore new warnings mysql-test/suite/binlog/r/binlog_unsafe.result: updated result file mysql-test/suite/binlog/t/binlog_unsafe.test: Added test for RAND(). Also clarified some old comments. mysql-test/suite/rpl/r/rpl_misc_functions.result: updated result file mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result: updated test case to ignore new warnings mysql-test/suite/rpl/r/rpl_optimize.result: updated result file mysql-test/suite/rpl/r/rpl_row_func003.result: updated result file mysql-test/suite/rpl/t/rpl_misc_functions.test: updated test case to ignore new warnings mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test: updated test case to ignore new warnings mysql-test/suite/rpl/t/rpl_optimize.test: updated test case to ignore new warnings mysql-test/suite/rpl/t/rpl_trigger.test: updated test case to ignore new warnings mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result: updated result file sql/item_create.cc: Mark RAND() unsafe.
28 lines
1 KiB
Text
28 lines
1 KiB
Text
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;
|
|
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
|
create table t1 (a int not null auto_increment primary key, b int, key(b));
|
|
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
INSERT INTO t1 (a) SELECT null FROM t1;
|
|
update t1 set b=(a/2*rand());
|
|
delete from t1 order by b limit 10000;
|
|
optimize table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 optimize status OK
|
|
drop table t1;
|