Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_jsondiff_multitables.test

raw
1 # ==== Purpose ====
2 #
3 # #R1. Multi-table UPDATE statements must generate partial JSON for all
4 # # involved tables where it is possible.
5 # # This does not work yet! It only generates partial JSON for the first
6 # # table. So we do not verify this.
7 #
8 # R2. Slave must apply multi-table partial JSON updates correctly.
9 #
10 # ==== Implementation ====
11 #
12 # Execute the following scenarios of two-table updates:
13 # 1. Both tables can use partial updates
14 # 2. Only first table can use partial updates
15 # 3. Only second table can use partial updates
16 # 4. Neither table can use partial updates
17 #
18 # ==== Related Worklog ====
19 #
20 # WL#2955: RBR replication of partial JSON updates
21
22 --source include/have_binlog_format_row.inc
23 --source include/master-slave.inc
24
25 --echo ######## Configure ########
26
27 SET @@SESSION.BINLOG_ROW_IMAGE = 'MINIMAL';
28 SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = 'PARTIAL_JSON';
29 --source include/rpl_connection_slave.inc
30
31 SET @old_binlog_row_image= @@GLOBAL.BINLOG_ROW_IMAGE;
32 SET @old_binlog_row_value_options= @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS;
33 SET @@GLOBAL.BINLOG_ROW_IMAGE = 'MINIMAL';
34 SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS = 'PARTIAL_JSON';
35
36 --source include/stop_slave.inc
37 --source include/start_slave.inc
38
39 --echo ######## Initialize ########
40
41 --source include/rpl_connection_master.inc
42
43 CREATE TABLE t1 (i INT PRIMARY KEY, j JSON);
44 CREATE TABLE t2 (i INT PRIMARY KEY, j JSON);
45
46 INSERT INTO t1 VALUES (1, '["a-1", "b-1"]');
47 INSERT INTO t2 VALUES (1, '["c-1", "d-1"]');
48 --source include/sync_slave_sql_with_master.inc
49
50 --echo ######## Test ########
51
52 --source include/rpl_connection_master.inc
53
54 --echo # Both tables with partial update
55 UPDATE t1, t2 SET t1.j= JSON_SET(t1.j, '$[0]', 'a-2'),
56 t2.j= JSON_SET(t2.j, '$[0]', 'c-2');
57
58 --source include/sync_slave_sql_with_master.inc
59 --source include/rpl_connection_master.inc
60 --let $diff_tables= master:t1, slave:t1
61 --source include/diff_tables.inc
62 --let $diff_tables= master:t2, slave:t2
63 --source include/diff_tables.inc
64
65 --echo # First table partial update, second table full update
66 UPDATE t1, t2 SET t1.j= JSON_SET(t1.j, '$[0]', 'a-3'),
67 t2.j= '["c-3", "d-1"]';
68
69 --source include/sync_slave_sql_with_master.inc
70 --source include/rpl_connection_master.inc
71 --let $diff_tables= master:t1, slave:t1
72 --source include/diff_tables.inc
73 --let $diff_tables= master:t2, slave:t2
74 --source include/diff_tables.inc
75
76 --echo # First table full update, second table partial update
77 UPDATE t1, t2 SET t1.j= '["a-4", "b-1"]',
78 t2.j= JSON_SET(t2.j, '$[0]', 'c-4');
79
80 --source include/sync_slave_sql_with_master.inc
81 --source include/rpl_connection_master.inc
82 --let $diff_tables= master:t1, slave:t1
83 --source include/diff_tables.inc
84 --let $diff_tables= master:t2, slave:t2
85 --source include/diff_tables.inc
86
87 --echo # Both tables with full update
88 UPDATE t1, t2 SET t1.j= '["a-5", "b-1"]',
89 t2.j= '["c-5", "d-1"]';
90
91 --source include/sync_slave_sql_with_master.inc
92 --source include/rpl_connection_master.inc
93 --let $diff_tables= master:t1, slave:t1
94 --source include/diff_tables.inc
95 --let $diff_tables= master:t2, slave:t2
96 --source include/diff_tables.inc
97
98 --echo ######## Clean up ########
99
100 DROP TABLE t1, t2;
101 --source include/sync_slave_sql_with_master.inc
102
103 SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= @old_binlog_row_value_options;
104 SET @@GLOBAL.BINLOG_ROW_IMAGE= @old_binlog_row_image;
105
106 --source include/rpl_end.inc