| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test that nondeterministic system functions are correctly replicated. |
| 4 |
# |
| 5 |
# (Some functions are only correctly replicated if binlog_format=MIXED |
| 6 |
# or ROW. See binlog_unsafe.test for a test that those variables are |
| 7 |
# indeed unsafe.) |
| 8 |
# |
| 9 |
# ==== Implementation ==== |
| 10 |
# |
| 11 |
# We insert the values of each unsafe function into a table. Then we |
| 12 |
# replicate and check that the table is identical on slave. |
| 13 |
# |
| 14 |
# ==== Related bugs ==== |
| 15 |
# |
| 16 |
# BUG#47995 |
| 17 |
--source include/not_group_replication_plugin.inc |
| 18 |
--source include/master-slave.inc |
| 19 |
|
| 20 |
CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT'); |
| 21 |
|
| 22 |
CREATE TABLE t1 (a VARCHAR(1000)); |
| 23 |
|
| 24 |
# We replicate the connection_id in the query_log_event |
| 25 |
INSERT INTO t1 VALUES (CONNECTION_ID()); |
| 26 |
--connection master1 |
| 27 |
INSERT INTO t1 VALUES (CONNECTION_ID()); |
| 28 |
|
| 29 |
# We replicate the TIMESTAMP variable, so the following functions that |
| 30 |
# are affected by the TIMESTAMP variable should be safe to replicate. |
| 31 |
INSERT INTO t1 VALUES |
| 32 |
(CURDATE()), |
| 33 |
(CURRENT_DATE()), |
| 34 |
(CURRENT_TIME()), |
| 35 |
(CURRENT_TIMESTAMP()), |
| 36 |
(CURTIME()), |
| 37 |
(LOCALTIME()), |
| 38 |
(LOCALTIMESTAMP()), |
| 39 |
(NOW()), |
| 40 |
(UNIX_TIMESTAMP()), |
| 41 |
(UTC_DATE()), |
| 42 |
(UTC_TIME()), |
| 43 |
(UTC_TIMESTAMP()); |
| 44 |
|
| 45 |
# We replicate the random seed in a rand_log_event |
| 46 |
--disable_warnings |
| 47 |
INSERT INTO t1 VALUES (RAND()); |
| 48 |
--enable_warnings |
| 49 |
# We replicate the last_insert_id in an intvar_log_event |
| 50 |
INSERT INTO t1 VALUES (LAST_INSERT_ID()); |
| 51 |
|
| 52 |
--source include/sync_slave_sql_with_master.inc |
| 53 |
--let $diff_tables= master:t1, slave:t1 |
| 54 |
--source include/diff_tables.inc |
| 55 |
|
| 56 |
--connection master |
| 57 |
DROP TABLE t1; |
| 58 |
--source include/rpl_end.inc |