Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_binlog_json.test

raw
1 # ==== Purpose ====
2 #
3 # Verify that mysqlbinlog is able to print JSON columns for row
4 # events correctly (NULL if the value is NULL, blob format otherwise).
5 #
6 # ==== Implementation ====
7 #
8 # Generate INSERT/UPDATE/DELETE with NULL and non-NULL values in both
9 # pre- and post-image. Then run mysqlbinlog to show the result.
10
11 --echo #
12 --echo # Bug#21276751 JSON+MYSQLBINLOG: JSON DATA NOT PRINTING PROPERLY
13 --echo # WHEN USING MYSQLBINLOG UTILITY
14 --echo #
15
16 --source include/have_binlog_format_row.inc
17 --source include/master-slave.inc
18
19 # this test prints the output of mysqlbinlog
20 --source include/not_binlog_transaction_compression_on.inc
21
22 connection master;
23 CREATE TABLE tab1 (json_col1 JSON);
24 INSERT INTO tab1 (json_col1) VALUES ('{"key": "value", "key2": [1, 2, 3]}');
25 SELECT json_col1 FROM tab1;
26 --source include/sync_slave_sql_with_master.inc
27 SELECT json_col1 FROM tab1;
28 connection master;
29 UPDATE tab1 SET json_col1 = JSON_SET(json_col1, '$.key3', 'abc');
30 SELECT json_col1 FROM tab1;
31 --source include/sync_slave_sql_with_master.inc
32 SELECT json_col1 FROM tab1;
33 connection master;
34 UPDATE tab1 SET json_col1 = NULL;
35 SELECT json_col1 FROM tab1;
36 --source include/sync_slave_sql_with_master.inc
37 SELECT json_col1 FROM tab1;
38 connection master;
39 UPDATE tab1 SET json_col1 = '[ 1, { "k" : "v" } ]' WHERE json_col1 IS NULL;
40 SELECT json_col1 FROM tab1;
41 --source include/sync_slave_sql_with_master.inc
42 SELECT json_col1 FROM tab1;
43 connection master;
44 INSERT INTO tab1 VALUES (NULL);
45 SELECT json_col1 FROM tab1;
46 --source include/sync_slave_sql_with_master.inc
47 SELECT json_col1 FROM tab1;
48 connection master;
49 DELETE FROM tab1;
50 SELECT json_col1 FROM tab1;
51 --source include/sync_slave_sql_with_master.inc
52 SELECT json_col1 FROM tab1;
53 connection master;
54 DROP TABLE tab1;
55
56 FLUSH LOGS;
57
58 --let $MYSQLD_DATADIR= `select @@datadir`
59 --let $mysqlbinlog_parameters= --base64-output=decode-rows --verbose $MYSQLD_DATADIR/master-bin.000001
60 --source include/mysqlbinlog.inc
61
62 --source include/rpl_end.inc