summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2016-11-03 14:48:51 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2016-11-03 14:48:51 +0100
commitb002509b67860df9f0634709b5fb8a2ab98d130a (patch)
tree3c1fb6c45a3a2275efc18e003bae531e81b3395e /mysql-test
parentd665e79c5b8582f44dc280e5e6df4a8ff4945623 (diff)
parent56a041cde657e5618c519a3c50e8075136d4a1ce (diff)
downloadmariadb-git-b002509b67860df9f0634709b5fb8a2ab98d130a.tar.gz
MDEV-11065: Compressed binary log. Merge code into current 10.2.
Conflicts: sql/share/errmsg-utf8.txt
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/binlog_start_pos.inc10
-rw-r--r--mysql-test/include/show_binlog_events2.inc2
-rw-r--r--mysql-test/r/flush2.result4
-rw-r--r--mysql-test/r/mysqlbinlog_row_compressed.result453
-rw-r--r--mysql-test/r/mysqlbinlog_row_minimal.result158
-rw-r--r--mysql-test/r/mysqlbinlog_stmt_compressed.result207
-rw-r--r--mysql-test/r/mysqld--help.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_log_bin.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_compress.result76
-rw-r--r--mysql-test/suite/rpl/r/rpl_checksum.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_compress.test61
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result28
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result28
-rw-r--r--mysql-test/t/mysqlbinlog_row_compressed.test68
-rw-r--r--mysql-test/t/mysqlbinlog_stmt_compressed.test59
16 files changed, 1084 insertions, 86 deletions
diff --git a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc
index a187e18b3a4..942a124d639 100644
--- a/mysql-test/include/binlog_start_pos.inc
+++ b/mysql-test/include/binlog_start_pos.inc
@@ -10,19 +10,19 @@
#
# Format_description_log_event length =
# 19 /* event common header */ +
-# 58 /* misc stuff in the Format description header */ +
+# 57 /* misc stuff in the Format description header */ +
# number of events +
# 1 /* Checksum algorithm */ +
# 4 /* CRC32 length */
#
-# With current number of events = 164,
+# With current number of events = 171,
#
-# binlog_start_pos = 4 + 19 + 57 + 163 + 1 + 4 = 249.
+# binlog_start_pos = 4 + 19 + 57 + 171 + 1 + 4 = 256.
#
##############################################################################
-let $binlog_start_pos=249;
+let $binlog_start_pos=256;
--disable_query_log
-SET @binlog_start_pos=249;
+SET @binlog_start_pos=256;
--enable_query_log
diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
index eefefe4bfbe..84c62cced66 100644
--- a/mysql-test/include/show_binlog_events2.inc
+++ b/mysql-test/include/show_binlog_events2.inc
@@ -4,7 +4,7 @@ if ($binlog_start)
}
if (!$binlog_start)
{
- --let $_binlog_start=249
+ --let $_binlog_start=256
}
if ($binlog_file)
{
diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result
index ff5d8755f01..a66b0d5c688 100644
--- a/mysql-test/r/flush2.result
+++ b/mysql-test/r/flush2.result
@@ -4,6 +4,8 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
@@ -20,6 +22,8 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
diff --git a/mysql-test/r/mysqlbinlog_row_compressed.result b/mysql-test/r/mysqlbinlog_row_compressed.result
new file mode 100644
index 00000000000..a612433fc2f
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog_row_compressed.result
@@ -0,0 +1,453 @@
+SET GLOBAL log_bin_compress=on;
+SET GLOBAL log_bin_compress_min_len=10;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
+DELETE FROM t1;
+DELETE FROM t2;
+FLUSH BINARY LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 4
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
+ROLLBACK/*!*/;
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
+/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
+/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
+/*!100001 SET @@session.server_id=1*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
+# at 371
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=X/*!*/;
+SET @@session.pseudo_thread_id=4/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 533
+#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
+/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
+# at 575
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 727
+#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3
+/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
+BEGIN
+/*!*/;
+# at 769
+#<date> server id 1 end_log_pos 825 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 825
+#<date> server id 1 end_log_pos 893 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 893
+#<date> server id 1 end_log_pos 966 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 966
+#<date> server id 1 end_log_pos 1008 CRC32 XXX GTID 0-1-4
+/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
+BEGIN
+/*!*/;
+# at 1008
+#<date> server id 1 end_log_pos 1064 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1064
+#<date> server id 1 end_log_pos 1131 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+# at 1131
+#<date> server id 1 end_log_pos 1204 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1204
+#<date> server id 1 end_log_pos 1246 CRC32 XXX GTID 0-1-5
+/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
+BEGIN
+/*!*/;
+# at 1246
+#<date> server id 1 end_log_pos 1302 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1302
+#<date> server id 1 end_log_pos 1368 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 1368
+#<date> server id 1 end_log_pos 1441 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1441
+#<date> server id 1 end_log_pos 1483 CRC32 XXX GTID 0-1-6
+/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
+BEGIN
+/*!*/;
+# at 1483
+#<date> server id 1 end_log_pos 1539 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1539
+#<date> server id 1 end_log_pos 1606 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 1606
+#<date> server id 1 end_log_pos 1679 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1679
+#<date> server id 1 end_log_pos 1721 CRC32 XXX GTID 0-1-7
+/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
+BEGIN
+/*!*/;
+# at 1721
+#<date> server id 1 end_log_pos 1777 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 1777
+#<date> server id 1 end_log_pos 1868 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F
+### INSERT INTO `test`.`t2`
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 1868
+#<date> server id 1 end_log_pos 1941 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1941
+#<date> server id 1 end_log_pos 1983 CRC32 XXX GTID 0-1-8
+/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
+BEGIN
+/*!*/;
+# at 1983
+#<date> server id 1 end_log_pos 2039 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2039
+#<date> server id 1 end_log_pos 2138 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F
+### UPDATE `test`.`t2`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### UPDATE `test`.`t2`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### UPDATE `test`.`t2`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2138
+#<date> server id 1 end_log_pos 2211 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2211
+#<date> server id 1 end_log_pos 2253 CRC32 XXX GTID 0-1-9
+/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
+BEGIN
+/*!*/;
+# at 2253
+#<date> server id 1 end_log_pos 2309 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 2309
+#<date> server id 1 end_log_pos 2401 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2401
+#<date> server id 1 end_log_pos 2474 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2474
+#<date> server id 1 end_log_pos 2516 CRC32 XXX GTID 0-1-10
+/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
+BEGIN
+/*!*/;
+# at 2516
+#<date> server id 1 end_log_pos 2572 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2572
+#<date> server id 1 end_log_pos 2657 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2657
+#<date> server id 1 end_log_pos 2730 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2730
+#<date> server id 1 end_log_pos 2778 CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+
+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;
diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result
index 2737d61eca4..2fb721d4103 100644
--- a/mysql-test/r/mysqlbinlog_row_minimal.result
+++ b/mysql-test/r/mysqlbinlog_row_minimal.result
@@ -14,20 +14,20 @@ FLUSH BINARY LOGS;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
-#<date> server id 1 end_log_pos 249 CRC32 XXX Start: xxx
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
ROLLBACK/*!*/;
-# at 249
-#<date> server id 1 end_log_pos 278 CRC32 XXX Gtid list []
-# at 278
-#<date> server id 1 end_log_pos 322 CRC32 XXX Binlog checkpoint master-bin.000001
-# at 322
-#<date> server id 1 end_log_pos 364 CRC32 XXX GTID 0-1-1 ddl
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
-# at 364
-#<date> server id 1 end_log_pos 548 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 371
+#<date> server id 1 end_log_pos 555 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=4/*!*/;
@@ -40,23 +40,23 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
-# at 548
-#<date> server id 1 end_log_pos 590 CRC32 XXX GTID 0-1-2 ddl
+# at 555
+#<date> server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
-# at 590
-#<date> server id 1 end_log_pos 767 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 597
+#<date> server id 1 end_log_pos 774 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
-# at 767
-#<date> server id 1 end_log_pos 809 CRC32 XXX GTID 0-1-3
+# at 774
+#<date> server id 1 end_log_pos 816 CRC32 XXX GTID 0-1-3
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
-# at 809
-#<date> server id 1 end_log_pos 865 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 865
-#<date> server id 1 end_log_pos 934 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+# at 816
+#<date> server id 1 end_log_pos 872 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 872
+#<date> server id 1 end_log_pos 941 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -68,20 +68,20 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 934
-#<date> server id 1 end_log_pos 1007 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 941
+#<date> server id 1 end_log_pos 1014 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1007
-#<date> server id 1 end_log_pos 1049 CRC32 XXX GTID 0-1-4
+# at 1014
+#<date> server id 1 end_log_pos 1056 CRC32 XXX GTID 0-1-4
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
BEGIN
/*!*/;
-# at 1049
-#<date> server id 1 end_log_pos 1105 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 1105
-#<date> server id 1 end_log_pos 1173 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+# at 1056
+#<date> server id 1 end_log_pos 1112 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1112
+#<date> server id 1 end_log_pos 1180 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */
@@ -93,20 +93,20 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
-# at 1173
-#<date> server id 1 end_log_pos 1246 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 1180
+#<date> server id 1 end_log_pos 1253 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1246
-#<date> server id 1 end_log_pos 1288 CRC32 XXX GTID 0-1-5
+# at 1253
+#<date> server id 1 end_log_pos 1295 CRC32 XXX GTID 0-1-5
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
BEGIN
/*!*/;
-# at 1288
-#<date> server id 1 end_log_pos 1344 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 1344
-#<date> server id 1 end_log_pos 1411 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+# at 1295
+#<date> server id 1 end_log_pos 1351 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1351
+#<date> server id 1 end_log_pos 1418 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */
@@ -118,20 +118,20 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1411
-#<date> server id 1 end_log_pos 1484 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 1418
+#<date> server id 1 end_log_pos 1491 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1484
-#<date> server id 1 end_log_pos 1526 CRC32 XXX GTID 0-1-6
+# at 1491
+#<date> server id 1 end_log_pos 1533 CRC32 XXX GTID 0-1-6
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
BEGIN
/*!*/;
-# at 1526
-#<date> server id 1 end_log_pos 1582 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 1582
-#<date> server id 1 end_log_pos 1652 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+# at 1533
+#<date> server id 1 end_log_pos 1589 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1589
+#<date> server id 1 end_log_pos 1659 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
@@ -143,20 +143,20 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1652
-#<date> server id 1 end_log_pos 1725 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 1659
+#<date> server id 1 end_log_pos 1732 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1725
-#<date> server id 1 end_log_pos 1767 CRC32 XXX GTID 0-1-7
+# at 1732
+#<date> server id 1 end_log_pos 1774 CRC32 XXX GTID 0-1-7
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
BEGIN
/*!*/;
-# at 1767
-#<date> server id 1 end_log_pos 1823 CRC32 XXX Table_map: `test`.`t2` mapped to number num
-# at 1823
-#<date> server id 1 end_log_pos 1990 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F
+# at 1774
+#<date> server id 1 end_log_pos 1830 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 1830
+#<date> server id 1 end_log_pos 1997 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F
### INSERT INTO `test`.`t2`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -201,20 +201,20 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1990
-#<date> server id 1 end_log_pos 2063 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 1997
+#<date> server id 1 end_log_pos 2070 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2063
-#<date> server id 1 end_log_pos 2105 CRC32 XXX GTID 0-1-8
+# at 2070
+#<date> server id 1 end_log_pos 2112 CRC32 XXX GTID 0-1-8
/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
BEGIN
/*!*/;
-# at 2105
-#<date> server id 1 end_log_pos 2161 CRC32 XXX Table_map: `test`.`t2` mapped to number num
-# at 2161
-#<date> server id 1 end_log_pos 2235 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F
+# at 2112
+#<date> server id 1 end_log_pos 2168 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2168
+#<date> server id 1 end_log_pos 2242 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F
### UPDATE `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -233,20 +233,20 @@ BEGIN
### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
-# at 2235
-#<date> server id 1 end_log_pos 2308 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 2242
+#<date> server id 1 end_log_pos 2315 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2308
-#<date> server id 1 end_log_pos 2350 CRC32 XXX GTID 0-1-9
+# at 2315
+#<date> server id 1 end_log_pos 2357 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
BEGIN
/*!*/;
-# at 2350
-#<date> server id 1 end_log_pos 2406 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 2406
-#<date> server id 1 end_log_pos 2460 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F
+# at 2357
+#<date> server id 1 end_log_pos 2413 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 2413
+#<date> server id 1 end_log_pos 2467 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -259,20 +259,20 @@ BEGIN
### DELETE FROM `test`.`t1`
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
-# at 2460
-#<date> server id 1 end_log_pos 2533 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 2467
+#<date> server id 1 end_log_pos 2540 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2533
-#<date> server id 1 end_log_pos 2575 CRC32 XXX GTID 0-1-10
+# at 2540
+#<date> server id 1 end_log_pos 2582 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
BEGIN
/*!*/;
-# at 2575
-#<date> server id 1 end_log_pos 2631 CRC32 XXX Table_map: `test`.`t2` mapped to number num
-# at 2631
-#<date> server id 1 end_log_pos 2685 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F
+# at 2582
+#<date> server id 1 end_log_pos 2638 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2638
+#<date> server id 1 end_log_pos 2692 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F
### DELETE FROM `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -285,13 +285,13 @@ BEGIN
### DELETE FROM `test`.`t2`
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
-# at 2685
-#<date> server id 1 end_log_pos 2758 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+# at 2692
+#<date> server id 1 end_log_pos 2765 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2758
-#<date> server id 1 end_log_pos 2806 CRC32 XXX Rotate to master-bin.000002 pos: 4
+# at 2765
+#<date> server id 1 end_log_pos 2813 CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/r/mysqlbinlog_stmt_compressed.result b/mysql-test/r/mysqlbinlog_stmt_compressed.result
new file mode 100644
index 00000000000..99f9c7e9914
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog_stmt_compressed.result
@@ -0,0 +1,207 @@
+SET GLOBAL log_bin_compress=on;
+SET GLOBAL log_bin_compress_min_len=10;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
+DELETE FROM t1;
+DELETE FROM t2;
+FLUSH BINARY LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 4
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
+ROLLBACK/*!*/;
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
+/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
+/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
+/*!100001 SET @@session.server_id=1*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
+# at 371
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=X/*!*/;
+SET @@session.pseudo_thread_id=4/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 533
+#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
+/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
+# at 575
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 727
+#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3
+/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
+BEGIN
+/*!*/;
+# at 769
+#<date> server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
+/*!*/;
+# at 897
+#<date> server id 1 end_log_pos 970 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 970
+#<date> server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4
+/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
+BEGIN
+/*!*/;
+# at 1012
+#<date> server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
+/*!*/;
+# at 1140
+#<date> server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1213
+#<date> server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5
+/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
+BEGIN
+/*!*/;
+# at 1255
+#<date> server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
+/*!*/;
+# at 1385
+#<date> server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1458
+#<date> server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6
+/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
+BEGIN
+/*!*/;
+# at 1500
+#<date> server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
+/*!*/;
+# at 1627
+#<date> server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1700
+#<date> server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7
+/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
+BEGIN
+/*!*/;
+# at 1742
+#<date> server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t2 SELECT * FROM t1
+/*!*/;
+# at 1850
+#<date> server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1923
+#<date> server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8
+/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
+BEGIN
+/*!*/;
+# at 1965
+#<date> server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
+/*!*/;
+# at 2082
+#<date> server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2155
+#<date> server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9
+/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
+BEGIN
+/*!*/;
+# at 2197
+#<date> server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+DELETE FROM t1
+/*!*/;
+# at 2288
+#<date> server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2361
+#<date> server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10
+/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
+BEGIN
+/*!*/;
+# at 2403
+#<date> server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+DELETE FROM t2
+/*!*/;
+# at 2494
+#<date> server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2567
+#<date> server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+
+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;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 32d38cd41ef..203921ce08f 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -344,6 +344,10 @@ The following options may be given as the first argument:
We strongly recommend to use either --log-basename or
specify a filename to ensure that replication doesn't
stop if the real hostname of the computer changes.
+ --log-bin-compress Whether the binary log can be compressed
+ --log-bin-compress-min-len[=#]
+ Minimum length of sql statement(in statement mode) or
+ record(in row mode)that can be compressed.
--log-bin-index=name
File that holds the names for last binary log files.
--log-bin-trust-function-creators
@@ -1267,6 +1271,8 @@ lc-time-names en_US
local-infile TRUE
lock-wait-timeout 31536000
log-bin (No default value)
+log-bin-compress FALSE
+log-bin-compress-min-len 256
log-bin-index (No default value)
log-bin-trust-function-creators FALSE
log-error
diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result
index 215e14f97df..d05a28847b4 100644
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result
@@ -3,6 +3,10 @@ Variable_name log_bin
Value ON
Variable_name log_bin_basename
Value MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name log_bin_compress
+Value OFF
+Variable_name log_bin_compress_min_len
+Value 256
Variable_name log_bin_index
Value MYSQLTEST_VARDIR/mysqld.1/data/mysqld-bin.index
Variable_name log_bin_trust_function_creators
diff --git a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
index fb7324ced34..09f2feae9c2 100644
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
@@ -3,6 +3,10 @@ Variable_name log_bin
Value ON
Variable_name log_bin_basename
Value MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name log_bin_compress
+Value OFF
+Variable_name log_bin_compress_min_len
+Value 256
Variable_name log_bin_index
Value MYSQLTEST_VARDIR/tmp/something.index
Variable_name log_bin_trust_function_creators
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_compress.result b/mysql-test/suite/rpl/r/rpl_binlog_compress.result
new file mode 100644
index 00000000000..d729611e885
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_compress.result
@@ -0,0 +1,76 @@
+include/master-slave.inc
+[connection master]
+set @old_log_bin_compress=@@log_bin_compress;
+set @old_log_bin_compress_min_len=@@log_bin_compress_min_len;
+set @old_binlog_format=@@binlog_format;
+set @old_binlog_row_image=@@binlog_row_image;
+set global log_bin_compress=on;
+set global log_bin_compress_min_len=10;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136;
+set binlog_format=statement;
+insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0);
+replace into t1 (pr_page, pr_type,test) values(1,"one",2);
+update t1 set test=test+1 where pr_page > 1;
+delete from t1 where test=1;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+connection slave;
+connection slave;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+connection master;
+set binlog_format=row;
+insert into t1 (pr_page, pr_type, test) values(3,"three",0),(4,"four",4),(5, "five", 0);
+replace into t1 (pr_page, pr_type,test) values(3,"one",2);
+update t1 set test=test+1 where pr_page > 3;
+delete from t1 where test=1;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+140 4 four 5
+139 3 three 0
+142 3 one 2
+connection slave;
+connection slave;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+140 4 four 5
+139 3 three 0
+142 3 one 2
+connection master;
+set binlog_row_image=minimal;
+insert into t1 (pr_page, pr_type, test) values(6,"six",0),(7,"seven",7),(8, "eight", 0);
+replace into t1 (pr_page, pr_type,test) values(6,"six",2);
+update t1 set test=test+1 where pr_page > 6;
+delete from t1 where test=1;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+140 4 four 5
+139 3 three 0
+144 7 seven 8
+142 3 one 2
+146 6 six 2
+connection slave;
+connection slave;
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+140 4 four 5
+139 3 three 0
+144 7 seven 8
+142 3 one 2
+146 6 six 2
+connection master;
+drop table t1;
+set global log_bin_compress=@old_log_bin_compress;
+set global log_bin_compress_min_len=@old_log_bin_compress_min_len;
+set binlog_format=@old_binlog_format;
+set binlog_row_image=@old_binlog_row_image;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index 820224d99da..e74e5af9f84 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -79,7 +79,7 @@ connection slave;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 368, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 375, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 256.''
select count(*) as zero from t1;
zero
0
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_compress.test b/mysql-test/suite/rpl/t/rpl_binlog_compress.test
new file mode 100644
index 00000000000..ef1e45084b6
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_compress.test
@@ -0,0 +1,61 @@
+#
+# Test of compressed binlog with replication
+#
+
+source include/master-slave.inc;
+
+set @old_log_bin_compress=@@log_bin_compress;
+set @old_log_bin_compress_min_len=@@log_bin_compress_min_len;
+set @old_binlog_format=@@binlog_format;
+set @old_binlog_row_image=@@binlog_row_image;
+
+set global log_bin_compress=on;
+set global log_bin_compress_min_len=10;
+
+drop table if exists t1;
+CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136;
+
+set binlog_format=statement;
+insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0);
+replace into t1 (pr_page, pr_type,test) values(1,"one",2);
+update t1 set test=test+1 where pr_page > 1;
+delete from t1 where test=1;
+
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+
+
+set binlog_format=row;
+insert into t1 (pr_page, pr_type, test) values(3,"three",0),(4,"four",4),(5, "five", 0);
+replace into t1 (pr_page, pr_type,test) values(3,"one",2);
+update t1 set test=test+1 where pr_page > 3;
+delete from t1 where test=1;
+
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+
+
+set binlog_row_image=minimal;
+insert into t1 (pr_page, pr_type, test) values(6,"six",0),(7,"seven",7),(8, "eight", 0);
+replace into t1 (pr_page, pr_type,test) values(6,"six",2);
+update t1 set test=test+1 where pr_page > 6;
+delete from t1 where test=1;
+
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+drop table t1;
+
+set global log_bin_compress=@old_log_bin_compress;
+set global log_bin_compress_min_len=@old_log_bin_compress_min_len;
+set binlog_format=@old_binlog_format;
+set binlog_row_image=@old_binlog_row_image;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 335716e3df3..b435844b4b5 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -1619,6 +1619,34 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME LOG_BIN_COMPRESS
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Whether the binary log can be compressed
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME LOG_BIN_COMPRESS_MIN_LEN
+SESSION_VALUE NULL
+GLOBAL_VALUE 256
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 256
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Minimum length of sql statement(in statement mode) or record(in row mode)that can be compressed.
+NUMERIC_MIN_VALUE 10
+NUMERIC_MAX_VALUE 1024
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_BIN_TRUST_FUNCTION_CREATORS
SESSION_VALUE NULL
GLOBAL_VALUE ON
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 6cc43cdc1dc..a7d0cc0f804 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -1759,6 +1759,34 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME LOG_BIN_COMPRESS
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Whether the binary log can be compressed
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME LOG_BIN_COMPRESS_MIN_LEN
+SESSION_VALUE NULL
+GLOBAL_VALUE 256
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 256
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Minimum length of sql statement(in statement mode) or record(in row mode)that can be compressed.
+NUMERIC_MIN_VALUE 10
+NUMERIC_MAX_VALUE 1024
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_BIN_INDEX
SESSION_VALUE NULL
GLOBAL_VALUE
diff --git a/mysql-test/t/mysqlbinlog_row_compressed.test b/mysql-test/t/mysqlbinlog_row_compressed.test
new file mode 100644
index 00000000000..1a7ce093986
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row_compressed.test
@@ -0,0 +1,68 @@
+#
+# Test for compressed row event
+#
+
+--source include/have_log_bin.inc
+--source include/have_binlog_format_row.inc
+
+#
+#
+# mysqlbinlog: compressed row event
+#
+#
+
+SET GLOBAL log_bin_compress=on;
+SET GLOBAL log_bin_compress_min_len=10;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
+DELETE FROM t1;
+DELETE FROM t2;
+
+--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
+--let $datadir = `SELECT @@datadir`
+
+FLUSH BINARY LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--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
+
+--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;
diff --git a/mysql-test/t/mysqlbinlog_stmt_compressed.test b/mysql-test/t/mysqlbinlog_stmt_compressed.test
new file mode 100644
index 00000000000..c4331ddf229
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_stmt_compressed.test
@@ -0,0 +1,59 @@
+#
+# Test for compressed query event
+#
+
+--source include/have_log_bin.inc
+--source include/have_binlog_format_statement.inc
+
+#
+#
+# mysqlbinlog: compressed query event
+#
+#
+
+SET GLOBAL log_bin_compress=on;
+SET GLOBAL log_bin_compress_min_len=10;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
+DELETE FROM t1;
+DELETE FROM t2;
+
+--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
+--let $datadir = `SELECT @@datadir`
+
+FLUSH BINARY LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--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
+
+--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;