File: binlog_json_mysqlbinlog.test

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 (49 lines) | stat: -rw-r--r-- 1,580 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
# ==== Requirements ====
#
# mysqlbinlog should decode rows containing JSON values correctly:
# R1. Correct JSON should be written (not the raw binary format)
# R2. JSON bigger than 65536 bytes should work
#
# ==== Implementation ====
#
# Execute an INSERT, an UPDATE, and a DELETE.
# Ensure that at least one of them has a value greater than 65536 bytes
# Check the output.
#
# Use sed to filter the huge strings from the output (not mysqltest's
# replace, because it is very slow on long strings.)
#
# ==== References ====
#
# BUG#26018522: MYSQLBINLOG -V PRINTS JSON IN ROW EVENTS WRONG


--source include/have_log_bin.inc
--source include/have_binlog_format_row.inc
--source include/have_util_sed.inc
--source include/have_grep.inc

--echo ==== Generate binlog ====

RESET MASTER;
CREATE TABLE t (i INT, j JSON);
SET @@SESSION.BINLOG_ROW_IMAGE = MINIMAL;
INSERT INTO t VALUES (1, '{"a" : 1}');
--let $long_json= `SELECT CONCAT('[', REPEAT('1, ', 100000), '1]')`
# Not mysqltest's 'replace' because it's slow on big strings
--disable_query_log
eval UPDATE t SET j = '$long_json' WHERE i = 1;
--enable_query_log
UPDATE t SET j = '1' WHERE i = 1;
DELETE FROM t;
DROP TABLE t;

--echo ==== Check output from mysqlbinlog ====

--let $datadir= `SELECT @@GLOBAL.DATADIR`
--source include/save_binlog_position.inc
# Not mysqltest's 'replace' because it's slow on big strings
--let $mysqlbinlog_pipe= | $SED 's/\[1, 1, 1, 1, .*/LONG_JSON/'
--let $mysqlbinlog_only_decoded_rows= 1
--let $mysqlbinlog_parameters= $datadir/$binlog_file -v --force-if-open
--source include/mysqlbinlog.inc