From 4693f01f57406f86a26b7ccc605522dac6a9abb2 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Wed, 5 Jul 2017 18:27:03 +0300 Subject: [PATCH 1/3] Fix warning discovered by ASAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch submitted by Eugene Kosov , comments added by commiter. Signed-off-by: Vicențiu Ciorbaru --- sql/sql_explain.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 6d208121e34..ac6bee05001 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -349,10 +349,13 @@ int print_explain_row(select_result_sink *result, item_list.push_back(new (mem_root) Item_string_sys(thd, jtype_str), mem_root); - /* 'possible_keys' */ + /* 'possible_keys' + The buffer must not be deallocated before we call send_data, otherwise + we may end up reading freed memory. + */ + StringBuffer<64> possible_keys_buf; if (possible_keys && !possible_keys->is_empty()) { - StringBuffer<64> possible_keys_buf; push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf); } else From ec76945daca3ef099ba7f5289b986a8360ede7c5 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Thu, 6 Jul 2017 00:45:43 +0300 Subject: [PATCH 2/3] MDEV-13248 binlog.binlog_parallel_replication_marks_row fails in buildbot The test did not handle correctly possible difference in system timezone. The fix is to remove non-functional setting of local time_zone and instead allow timestamp replacement to work with any date/time --- mysql-test/include/binlog_parallel_replication_marks.test | 7 +------ .../binlog/r/binlog_parallel_replication_marks_row.result | 3 --- .../r/binlog_parallel_replication_marks_stm_mix.result | 3 --- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/mysql-test/include/binlog_parallel_replication_marks.test b/mysql-test/include/binlog_parallel_replication_marks.test index 1b6fbe26142..ff35875aece 100644 --- a/mysql-test/include/binlog_parallel_replication_marks.test +++ b/mysql-test/include/binlog_parallel_replication_marks.test @@ -7,10 +7,6 @@ RESET MASTER; --source include/wait_for_binlog_checkpoint.inc -set time_zone="+02:00"; ---let $stable_stamp= `SELECT UNIX_TIMESTAMP("2020-01-21 15:32:22")` -eval set timestamp=$stable_stamp; - CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; --let $binlog_pos1=query_get_value(SHOW MASTER STATUS, Position, 1) /* GTID */ INSERT INTO t1 VALUES (1,0); @@ -42,7 +38,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; /* GTID */ INSERT INTO t1 VALUES (9, 5, 1); /* GTID */ COMMIT; connect (tmp_con,localhost,root,,); -eval set timestamp=$stable_stamp; /* GTID */ INSERT INTO t1 VALUES (10, 6, 0); /* GTID */ BEGIN; /* GTID */ CREATE TEMPORARY TABLE t5 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -72,7 +67,7 @@ my $file= $ENV{'OUTPUT_FILE'}; open F, "<", $file or die "Unable to open file '$file': $!\n"; while () { - s/^#\d+ \d+:\d+:\d+ /# /; + s/^#\d+ +\d+:\d+:\d+ /# /; s/GTID \d+-\d+-\d+/GTID #-#-#/; s/end_log_pos \d+/end_log_pos #/; s/table id \d+/table id #/; diff --git a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result index b0bba30bd00..e9a744a748e 100644 --- a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result +++ b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result @@ -1,6 +1,4 @@ RESET MASTER; -set time_zone="+02:00"; -set timestamp=1579613542; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; /* GTID */ INSERT INTO t1 VALUES (1,0); /* GTID */ BEGIN; @@ -30,7 +28,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; /* GTID */ ALTER TABLE t4 ADD b INT; /* GTID */ INSERT INTO t1 VALUES (9, 5, 1); /* GTID */ COMMIT; -set timestamp=1579613542; /* GTID */ INSERT INTO t1 VALUES (10, 6, 0); /* GTID */ BEGIN; /* GTID */ CREATE TEMPORARY TABLE t5 (a INT PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_stm_mix.result b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_stm_mix.result index c5dffff7446..c2876a3e849 100644 --- a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_stm_mix.result +++ b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_stm_mix.result @@ -1,6 +1,4 @@ RESET MASTER; -set time_zone="+02:00"; -set timestamp=1579613542; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; /* GTID */ INSERT INTO t1 VALUES (1,0); /* GTID */ BEGIN; @@ -30,7 +28,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; /* GTID */ ALTER TABLE t4 ADD b INT; /* GTID */ INSERT INTO t1 VALUES (9, 5, 1); /* GTID */ COMMIT; -set timestamp=1579613542; /* GTID */ INSERT INTO t1 VALUES (10, 6, 0); /* GTID */ BEGIN; /* GTID */ CREATE TEMPORARY TABLE t5 (a INT PRIMARY KEY) ENGINE=InnoDB; From 2b5c9bc2c813ea7963959e515da5d60392c35431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 6 Jul 2017 14:18:53 +0300 Subject: [PATCH 3/3] MDEV-13247 innodb_log_compressed_pages=OFF breaks crash recovery of ROW_FORMAT=COMPRESSED tables The option innodb_log_compressed_pages was contributed by Facebook to MySQL 5.6. It was disabled in the 5.6.10 GA release due to problems that were fixed in 5.6.11, which is when the option was enabled. The option was set to innodb_log_compressed_pages=ON by default (disabling the feature), because safety was considered more important than speed. The option innodb_log_compressed_pages=OFF can *CORRUPT* ROW_FORMAT=COMPRESSED tables on crash recovery if the zlib deflate function is behaving differently (producing a different amount of compressed data) from how it behaved when the redo log records were written (prior to the crash recovery). In MDEV-6935, the default value was changed to innodb_log_compressed_pages=OFF. This is inherently unsafe, because there are very many different environments where MariaDB can be running, using different zlib versions. While zlib can decompress data just fine, there are no guarantees that different versions will always compress the same data to the exactly same size. To avoid problems related to zlib upgrades or version mismatch, we must use a safe default setting. This will reduce the write performance for users of ROW_FORMAT=COMPRESSED tables. If you configure innodb_log_compressed_pages=ON, please make sure that you will always cleanly shut down InnoDB before upgrading the server or zlib. --- .../r/innodb_log_compressed_pages_basic.result | 4 ++-- .../suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff | 2 +- .../suite/sys_vars/r/sysvars_innodb,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 4 ++-- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/page/page0zip.cc | 10 +++++----- storage/xtradb/handler/ha_innodb.cc | 2 +- storage/xtradb/page/page0zip.cc | 10 +++++----- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_log_compressed_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_compressed_pages_basic.result index 3b1ad38fd31..8cb8d900b59 100644 --- a/mysql-test/suite/sys_vars/r/innodb_log_compressed_pages_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_compressed_pages_basic.result @@ -1,7 +1,7 @@ SET @start_global_value = @@global.innodb_log_compressed_pages; SELECT @start_global_value; @start_global_value -0 +1 '#---------------------BS_STVARS_028_01----------------------#' SELECT COUNT(@@GLOBAL.innodb_log_compressed_pages); COUNT(@@GLOBAL.innodb_log_compressed_pages) @@ -66,4 +66,4 @@ ERROR 42S22: Unknown column 'innodb_log_compressed_pages' in 'field list' SET @@global.innodb_log_compressed_pages = @start_global_value; SELECT @@global.innodb_log_compressed_pages; @@global.innodb_log_compressed_pages -0 +1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index f5ce4d77c6b..b7025bcd606 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -705,7 +705,7 @@ +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES SESSION_VALUE NULL - GLOBAL_VALUE OFF + GLOBAL_VALUE ON GLOBAL_VALUE_ORIGIN COMPILE-TIME @@ -1397,7 +1677,7 @@ GLOBAL_VALUE_ORIGIN CONFIG diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 9199653b460..af8777c4f4b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -379,7 +379,7 @@ +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES SESSION_VALUE NULL - GLOBAL_VALUE OFF + GLOBAL_VALUE ON @@ -1447,6 +1727,34 @@ ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 76f8317b77a..879e3df0fb0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1393,9 +1393,9 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES SESSION_VALUE NULL -GLOBAL_VALUE OFF +GLOBAL_VALUE ON GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE OFF +DEFAULT_VALUE ON VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN VARIABLE_COMMENT Enables/disables the logging of entire compressed page images. InnoDB logs the compressed pages to prevent corruption if the zlib compression algorithm changes. When turned OFF, InnoDB will assume that the zlib compression algorithm doesn't change. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6c43e637318..1c38af2441f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19147,7 +19147,7 @@ static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages, " the zlib compression algorithm changes." " When turned OFF, InnoDB will assume that the zlib" " compression algorithm doesn't change.", - NULL, NULL, FALSE); + NULL, NULL, TRUE); static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 787f6947c0c..b4a8719c920 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2014, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -82,12 +82,12 @@ UNIV_INTERN mysql_pfs_key_t page_zip_stat_per_index_mutex_key; #endif /* HAVE_PSI_INTERFACE */ #endif /* !UNIV_HOTBACKUP */ -/* Compression level to be used by zlib. Settable by user. */ -UNIV_INTERN uint page_zip_level = DEFAULT_COMPRESSION_LEVEL; +/** Compression level to be used by zlib. Settable by user. */ +UNIV_INTERN uint page_zip_level; -/* Whether or not to log compressed page images to avoid possible +/** Whether or not to log compressed page images to avoid possible compression algorithm changes in zlib. */ -UNIV_INTERN my_bool page_zip_log_pages = false; +UNIV_INTERN my_bool page_zip_log_pages; /* Please refer to ../include/page0zip.ic for a description of the compressed page format. */ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index eb02ed6699e..0dfa2a50654 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -20294,7 +20294,7 @@ static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages, " the zlib compression algorithm changes." " When turned OFF, InnoDB will assume that the zlib" " compression algorithm doesn't change.", - NULL, NULL, FALSE); + NULL, NULL, TRUE); static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc index 32e76fb44e6..bf7b4928e61 100644 --- a/storage/xtradb/page/page0zip.cc +++ b/storage/xtradb/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, SkySQL Ab. All Rights Reserved. +Copyright (c) 2014, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -83,12 +83,12 @@ UNIV_INTERN mysql_pfs_key_t page_zip_stat_per_index_mutex_key; #endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_HOTBACKUP */ -/* Compression level to be used by zlib. Settable by user. */ -UNIV_INTERN uint page_zip_level = DEFAULT_COMPRESSION_LEVEL; +/** Compression level to be used by zlib. Settable by user. */ +UNIV_INTERN uint page_zip_level; -/* Whether or not to log compressed page images to avoid possible +/** Whether or not to log compressed page images to avoid possible compression algorithm changes in zlib. */ -UNIV_INTERN my_bool page_zip_log_pages = false; +UNIV_INTERN my_bool page_zip_log_pages; /* Please refer to ../include/page0zip.ic for a description of the compressed page format. */