mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 22:34:18 +01:00
94946c6807
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.
27 lines
707 B
Text
27 lines
707 B
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 VARCHAR(1000));
|
|
INSERT INTO t1 VALUES (CONNECTION_ID());
|
|
INSERT INTO t1 VALUES (CONNECTION_ID());
|
|
INSERT INTO t1 VALUES
|
|
(CURDATE()),
|
|
(CURRENT_DATE()),
|
|
(CURRENT_TIME()),
|
|
(CURRENT_TIMESTAMP()),
|
|
(CURTIME()),
|
|
(LOCALTIME()),
|
|
(LOCALTIMESTAMP()),
|
|
(NOW()),
|
|
(UNIX_TIMESTAMP()),
|
|
(UTC_DATE()),
|
|
(UTC_TIME()),
|
|
(UTC_TIMESTAMP());
|
|
INSERT INTO t1 VALUES (RAND());
|
|
INSERT INTO t1 VALUES (LAST_INSERT_ID());
|
|
Comparing tables master:test.t1 and slave:test.t1
|
|
DROP TABLE t1;
|