Debian Codegraph @

mysql-test/suite/binlog/t/binlog_json_mysqlbinlog.test

raw
1 # ==== Requirements ====
2 #
3 # mysqlbinlog should decode rows containing JSON values correctly:
4 # R1. Correct JSON should be written (not the raw binary format)
5 # R2. JSON bigger than 65536 bytes should work
6 #
7 # ==== Implementation ====
8 #
9 # Execute an INSERT, an UPDATE, and a DELETE.
10 # Ensure that at least one of them has a value greater than 65536 bytes
11 # Check the output.
12 #
13 # Use sed to filter the huge strings from the output (not mysqltest's
14 # replace, because it is very slow on long strings.)
15 #
16 # ==== References ====
17 #
18 # BUG#26018522: MYSQLBINLOG -V PRINTS JSON IN ROW EVENTS WRONG
19
20
21 --source include/have_log_bin.inc
22 --source include/have_binlog_format_row.inc
23 --source include/have_util_sed.inc
24 --source include/have_grep.inc
25
26 --echo ==== Generate binlog ====
27
28 RESET MASTER;
29 CREATE TABLE t (i INT, j JSON);
30 SET @@SESSION.BINLOG_ROW_IMAGE = MINIMAL;
31 INSERT INTO t VALUES (1, '{"a" : 1}');
32 --let $long_json= `SELECT CONCAT('[', REPEAT('1, ', 100000), '1]')`
33 # Not mysqltest's 'replace' because it's slow on big strings
34 --disable_query_log
35 eval UPDATE t SET j = '$long_json' WHERE i = 1;
36 --enable_query_log
37 UPDATE t SET j = '1' WHERE i = 1;
38 DELETE FROM t;
39 DROP TABLE t;
40
41 --echo ==== Check output from mysqlbinlog ====
42
43 --let $datadir= `SELECT @@GLOBAL.DATADIR`
44 --source include/save_binlog_position.inc
45 # Not mysqltest's 'replace' because it's slow on big strings
46 --let $mysqlbinlog_pipe= | $SED 's/\[1, 1, 1, 1, .*/LONG_JSON/'
47 --let $mysqlbinlog_only_decoded_rows= 1
48 --let $mysqlbinlog_parameters= $datadir/$binlog_file -v --force-if-open
49 --source include/mysqlbinlog.inc