Commit 2b5c9bc2 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent ec76945d
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
......@@ -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
......
......@@ -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
......
......@@ -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.
......
......@@ -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,
......
......@@ -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. */
......
......@@ -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,
......
......@@ -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. */
......
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