Debian Codegraph @

mysql-test/suite/perfschema/include/binlog_edge_common_myisam.inc

raw
1 # Test replication, when using special non-replicated tables.
2 #
3 # This test involve special statements that use non-replicated tables.
4 # Changes affecting non replicated tables are never written to the binlog.
5 # Executing these statements may or may not work, as the statements involved
6 # are edge cases.
7 # In MIXED or ROW binlog format, execution should succeed,
8 # and only partial data (the rows affecting replicated tables only)
9 # should be written to the binlog.
10 # In STATEMENT binlog format, execution should
11 # raise a warning (ER_BINLOG_UNSAFE_STATEMENT) if a non replicated table is
12 # only read from, or fail with an error (ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES)
13 # if a non replicated table is written to.
14 #
15 # SHOW ERRORS will print in the
16 # test .result file the exact outcome.
17
18 RESET MASTER;
19
20 --disable_warnings
21 drop database if exists my_replicated_db;
22 --enable_warnings
23
24 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
25
26 create database my_replicated_db;
27
28 create table my_replicated_db.my_non_tx_table(a bigint) engine = myisam;
29
30 use test;
31 drop table if exists marker_start;
32
33 use my_replicated_db;
34
35 insert into my_non_tx_table(a)
36 values (1000), (2000), (3000);
37
38 use test;
39 drop table if exists marker_insert_select;
40
41 use my_replicated_db;
42
43 # Note:
44 # The queries used here do not make any sense (no semantic).
45 # What this test is interrested in, is check the behavior
46 # when replicating queries that mix both:
47 # - non replicated tables
48 # - replicated tables
49
50 insert into my_non_tx_table(a)
51 select thread_id from performance_schema.threads;
52
53 # For the information_schema,
54 # no error is enforced yet.
55 # Documenting the current behavior
56
57 insert into my_non_tx_table(a)
58 select id from information_schema.processlist;
59
60 insert into my_non_tx_table(a)
61 select thread_id from mysql.general_log;
62
63 insert into my_non_tx_table(a)
64 select thread_id from mysql.slow_log;
65
66 insert into my_non_tx_table(a)
67 select Relay_log_pos from mysql.slave_relay_log_info;
68
69 insert into my_non_tx_table(a)
70 select Master_log_pos from mysql.slave_master_info;
71
72 insert into my_non_tx_table(a)
73 select Relay_log_pos from mysql.slave_worker_info;
74
75
76 use test;
77 drop table if exists marker_multi_update;
78
79 use my_replicated_db;
80
81 --error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
82 update my_non_tx_table, performance_schema.setup_instruments
83 set my_non_tx_table.a = my_non_tx_table.a + 1,
84 performance_schema.setup_instruments.timed= 'NO';
85
86 use test;
87 drop table if exists marker_multi_delete;
88
89 use my_replicated_db;
90
91 insert into performance_schema.setup_actors
92 values ('BAR', 'BAR', 'BAR', 'YES', 'YES');
93
94 --error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
95 delete my_non_tx_table.*, performance_schema.setup_actors.*
96 from my_non_tx_table, performance_schema.setup_actors
97 where my_non_tx_table.a != 1000
98 or performance_schema.setup_actors.role='BAR';
99
100 use test;
101 drop table if exists marker_end;
102
103 drop database my_replicated_db;
104
105 --source include/show_binlog_events.inc
106
107 # Restore performance_schema.setup_actors, damaged by this script
108
109 truncate table performance_schema.setup_actors;
110 insert into performance_schema.setup_actors values ('%', '%', '%', 'YES', 'YES');
111