File: rpl_row_jsondiff_init.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (175 lines) | stat: -rw-r--r-- 5,700 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# ==== Overview ====
#
# This script works in conjuction with:
#
#   extra/rpl_tests/rpl_row_jsondiff_[basic|datatypes|...].inc
#   extra/rpl_tests/rpl_row_jsondiff_scenario.inc
#   extra/rpl_tests/rpl_row_jsondiff_exit.inc
#
# A .test file in the suite typically does the following:
#
#   --source extra/rpl_tests/rpl_row_jsondiff_init.inc
#   --source extra/rpl_tests/rpl_row_jsondiff_[basic|datatypes|...]inc
#   --source extra/rpl_tests/rpl_row_jsondiff_exit.inc
#
# where:
# - This 'init' script sets up replication topologies and some configuration.
# - Each 'basic'/'datatypes'/etc script defines a number of scenarios.
# - A scenario is executed by invoking the 'scenario' script with appropriate
#   parameters.
# - The 'exit' script cleans up.
#
# ==== Requirements ====
#
# This script sets up a replication topology, in order to cover the
# following configurations and methods to apply rows:
#
# - Re-applying partial JSON updates should work in the following
#   cases:
#   - Replication to slave
#   - Chained replication to slave-of-slave
#   - Applying BINLOG 'base64' statements from mysqlbinlog
#   - Applying the decoded pseudo-SQL from mysqlbinlog -v, if
#     re-formatted into correct SQL.
#
# - Replication should work with minimal/full row images on
#   master/slave, including the following cases:
#   - minimal->minimal
#   - minimal->full
#   - full->full
#   - full->minimal,
#   - full->minimal->minimal.  Note: due to the semantics of
#     binlog_row_image=minimal, the first slave in this configuration
#     does not produce the same after-image as a master having
#     minimal.  When the master has full, the slave will include the
#     full after-image even when binlog_row_image=minimal, because it
#     always includes all columns that were specified.  Therefore, we
#     also test that replication to the second slave works, to verify
#     that this 'minimal with full after-image' format is correct.
#     Cf. BUG#26258329.
#
#   Since NOBLOB is similar to MINIMAL for JSON columns, we consider
#   NOBLOB tested due to having tested MINIMAL.
#
# - All the above should hold when:
#
#   - slave_rows_search_algorithms=HASH_SCAN/TABLE_SCAN with and
#     without a primary key
#
#   - slave_rows_search_algorithms=INDEX_SCAN with a primary key.
#
# ==== Usage ====
#
# [--let $replace_combination_from= SCOPE.VARIABLE=VALUE[,VALUE[,...]]
# [--let $replace_combination_to= SCOPE.VARIABLE=VALUE[,VALUE[,...]]
# --source include/rpl_row_jsondiff_init.inc
#
# [set $variables to describe a scenario]
# --source rpl_row_jsondiff_scenario.inc
#
# [set more $variables to describe another scenario]
# --source rpl_row_jsondiff_scenario.inc
#
# ...
#
# --source include/rpl_row_jsondiff_exit.inc
#
# Parameters:
#   $replace_combination_from, $replace_combination_to
#     If set, this script will source
#     include/begin_replace_combination.inc just after
#     include/rpl_init.inc, and rpl_row_jsondiff_exit.inc will source
#     include/end_replace_combination just before include/rpl_end.inc.
#     See include/begin_replace_combination.inc for details.
#
# ==== Implementation ====
#
# Setup the following replication topology:
#
#   master -> slave_1 -> slave_2 -> slave_3 -> slave_4 -> slave_5
#   decoded
#   base64
#
# where:
# - master, slave_1, slave_4, slave_5 use binlog_row_image=MINIMAL
# - slave_2, slave_3 use binlog_row_image=FULL
# - row events decoded into SQL by mysqlbinlog will be applied on 'decoded'
# - BINLOG 'base64' statements generated by mysqlbinlog will be applied on
#   'base64'
#
# Set binlog_row_value_options=PARTIAL_JSON on all servers.
#
# ==== References ====
#
# WL#2955: RBR replication of partial JSON updates


# ######## CONFIGURE ########

--source include/have_log_bin.inc

--let $rpl_server_count= 8
--let $rpl_topology= 1->2->3->4->5->6
--source include/rpl_init.inc
--source include/rpl_default_connections.inc

if ($replace_combination_from)
{
  --let $replace_combination_on_all_servers= 1
  # To avoid an error 'ER_RUNNING_APPLIER_PREVENTS_SWITCH_GLOBAL_BINLOG_FORMAT',
  # which will be caused by the following include/begin_replace_combination.inc.
  --source include/rpl_stop_slaves.inc
  --source include/begin_replace_combination.inc
  --source include/rpl_start_slaves.inc
}


--echo ######## INITIALIZE ########

# mysqltest gets confused by dollars, and does not know how to escape them
--let $dollar_func= CHAR(36)
--let $dollar= `SELECT $dollar_func`
--let $master_con= server_1
--let $slave_1_con= server_2
--let $slave_2_con= server_3
--let $slave_3_con= server_4
--let $slave_4_con= server_5
--let $slave_5_con= server_6
--let $base64_con= server_7
--let $decoded_con= server_8

--connection $master_con

# Enable PARTIAL_JSON on all servers, set binlog_row_image=MINIMAL on
# all servers except server_2 and server_3.
--disable_query_log
--delimiter |
let $rpl_sql=
  SET @@SESSION.BINLOG_ROW_IMAGE = MINIMAL;
  SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = PARTIAL_JSON;
  SET @@GLOBAL.BINLOG_ROW_IMAGE = MINIMAL;
  SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS = PARTIAL_JSON;
|
--delimiter ;
--source include/rpl_for_each_server_stmt.inc
--disable_warnings
--connection $slave_2_con
SET @@SESSION.BINLOG_ROW_IMAGE = FULL;
SET @@GLOBAL.BINLOG_ROW_IMAGE = FULL;
--connection $slave_3_con
SET @@SESSION.BINLOG_ROW_IMAGE = FULL;
SET @@GLOBAL.BINLOG_ROW_IMAGE = FULL;
--enable_warnings
--connection $master_con
--source include/rpl_stop_slaves.inc
--source include/rpl_start_slaves.inc


# Set 'constant' parameters of rpl_row_jsondiff_scenario.test
--let $echo_stmt= 1
--let $echo_decoded_rows= 1
--let $table= test.t
--let $scenario_inc= extra/rpl_tests/rpl_row_jsondiff_scenario.inc


--disable_query_log