Commit 56a041cd authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-11065: Compressed binary log. Fix BINLOG statement.

BINLOG statement output by mysqlbinlog actually has the base64 of the
non-compressed event. So remove my previous incorrect review change,
which allowed compressed event types for BINLOG statement.

Also add a couple test cases for this, running mysqlbinlog | mysql.
parent 3c0ff615
......@@ -408,6 +408,46 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP TABLE t1,t2;
Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
FLUSH BINARY LOGS;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
INSERT INTO t3 VALUES (0, 10, "hello");
BEGIN;
INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
INSERT INTO t3 VALUES (4, 10, "goodbye");
COMMIT;
UPDATE t3 SET b=b+100 where a<>1;
DELETE FROM t3 WHERE a=2;
SET @old_image=@@binlog_row_image;
SET binlog_row_image=minimal;
INSERT INTO t3 VALUES (5, 20, "red"), (6, 30, "green"), (7, 40, "blue");
INSERT INTO t3 VALUES (8, 20, "rigel");
UPDATE t3 SET c = concat("colour of ", c) WHERE a > 5;
UPDATE t3 SET b=b*2 WHERE a IN (5,6,7);
DELETE FROM t3 WHERE a=6;
SET binlog_row_image=@old_image;
SELECT * FROM t3 ORDER BY a;
a b c
0 110 hello
1 10 cat
3 110 dog
4 110 goodbye
5 40 red
7 80 colour of blue
8 20 colour of rigel
FLUSH LOGS;
DROP TABLE t3;
SELECT * FROM t3 ORDER BY a;
a b c
0 110 hello
1 10 cat
3 110 dog
4 110 goodbye
5 40 red
7 80 colour of blue
8 20 colour of rigel
DROP TABLE t1,t2,t3;
SET GLOBAL log_bin_compress=off;
SET GLOBAL log_bin_compress_min_len=256;
......@@ -177,6 +177,31 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP TABLE t1,t2;
Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
FLUSH BINARY LOGS;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
INSERT INTO t3 VALUES (0, 10, "hello");
BEGIN;
INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
INSERT INTO t3 VALUES (4, 10, "goodbye");
COMMIT;
DELETE FROM t3 WHERE a=2;
SELECT * FROM t3 ORDER BY a;
a b c
0 10 hello
1 10 cat
3 10 dog
4 10 goodbye
FLUSH LOGS;
DROP TABLE t3;
SELECT * FROM t3 ORDER BY a;
a b c
0 10 hello
1 10 cat
3 10 dog
4 10 goodbye
DROP TABLE t1,t2,t3;
SET GLOBAL log_bin_compress=off;
SET GLOBAL log_bin_compress_min_len=256;
......@@ -32,6 +32,37 @@ FLUSH BINARY LOGS;
--replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
DROP TABLE t1,t2;
--echo
--echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
--echo
FLUSH BINARY LOGS;
--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1)
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
INSERT INTO t3 VALUES (0, 10, "hello");
BEGIN;
INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
INSERT INTO t3 VALUES (4, 10, "goodbye");
COMMIT;
UPDATE t3 SET b=b+100 where a<>1;
DELETE FROM t3 WHERE a=2;
SET @old_image=@@binlog_row_image;
SET binlog_row_image=minimal;
INSERT INTO t3 VALUES (5, 20, "red"), (6, 30, "green"), (7, 40, "blue");
INSERT INTO t3 VALUES (8, 20, "rigel");
UPDATE t3 SET c = concat("colour of ", c) WHERE a > 5;
UPDATE t3 SET b=b*2 WHERE a IN (5,6,7);
DELETE FROM t3 WHERE a=6;
SET binlog_row_image=@old_image;
SELECT * FROM t3 ORDER BY a;
FLUSH LOGS;
DROP TABLE t3;
--let $MYSQLD_DATADIR= `select @@datadir`
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL
SELECT * FROM t3 ORDER BY a;
DROP TABLE t1,t2,t3;
SET GLOBAL log_bin_compress=off;
SET GLOBAL log_bin_compress_min_len=256;
......@@ -32,6 +32,28 @@ FLUSH BINARY LOGS;
--replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
DROP TABLE t1,t2;
--echo
--echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
--echo
FLUSH BINARY LOGS;
--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1)
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
INSERT INTO t3 VALUES (0, 10, "hello");
BEGIN;
INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
INSERT INTO t3 VALUES (4, 10, "goodbye");
COMMIT;
DELETE FROM t3 WHERE a=2;
SELECT * FROM t3 ORDER BY a;
FLUSH LOGS;
DROP TABLE t3;
--let $MYSQLD_DATADIR= `select @@datadir`
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL
SELECT * FROM t3 ORDER BY a;
DROP TABLE t1,t2,t3;
SET GLOBAL log_bin_compress=off;
SET GLOBAL log_bin_compress_min_len=256;
......@@ -82,12 +82,6 @@ static int check_event_type(int type, Relay_log_info *rli)
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case WRITE_ROWS_COMPRESSED_EVENT_V1:
case UPDATE_ROWS_COMPRESSED_EVENT_V1:
case DELETE_ROWS_COMPRESSED_EVENT_V1:
case WRITE_ROWS_COMPRESSED_EVENT:
case UPDATE_ROWS_COMPRESSED_EVENT:
case DELETE_ROWS_COMPRESSED_EVENT:
/*
Row events are only allowed if a Format_description_event has
already been seen.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment