Commit 5bea43f5 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12353: Deprecate and ignore innodb_log_compressed_pages

page_zip_compress_write_log_no_data(): Remove.
We no longer write the MLOG_ZIP_PAGE_COMPRESS_NO_DATA record.
Instead, we will write MLOG_ZIP_PAGE_COMPRESS records.
parent 600eae91
......@@ -52,24 +52,22 @@ SELECT
database_name,
table_name,
index_name,
CASE WHEN compress_ops=47 and @@innodb_compression_level IN (4,8,9) THEN 65
ELSE compress_ops END as compress_ops,
CASE WHEN compress_ops_ok=47 and @@innodb_compression_level IN (4,8,9) THEN 65
ELSE compress_ops_ok END as compress_ops_ok,
compress_ops,
compress_ops_ok,
uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
database_name test
table_name t
index_name b
compress_ops 43
compress_ops_ok 43
compress_ops 52
compress_ops_ok 52
uncompress_ops 0
database_name test
table_name t
index_name PRIMARY
compress_ops 65
compress_ops_ok 65
compress_ops 64
compress_ops_ok 64
uncompress_ops 0
DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
--innodb_log_compressed_pages=on
--innodb_cmp_per_index_reset
......@@ -4,16 +4,6 @@
-- source include/have_innodb.inc
# Using innodb_log_compressed=0 leads to a larger number of page
# compressions, because page_cur_insert_rec_zip() will reorganize the
# page before attempting an insert followed by page compression and
# page_zip_compress_write_log_no_data().
if (`SELECT @@innodb_log_compressed_pages = 0`)
{
--skip Needs innodb_log_compressed_pages
}
# numbers read in this test depend on the page size
-- source include/have_innodb_16k.inc
# include/restart_mysqld.inc does not work in embedded mode
......@@ -86,10 +76,8 @@ SELECT
database_name,
table_name,
index_name,
CASE WHEN compress_ops=47 and @@innodb_compression_level IN (4,8,9) THEN 65
ELSE compress_ops END as compress_ops,
CASE WHEN compress_ops_ok=47 and @@innodb_compression_level IN (4,8,9) THEN 65
ELSE compress_ops_ok END as compress_ops_ok,
compress_ops,
compress_ops_ok,
uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
......
......@@ -9,18 +9,26 @@ COUNT(@@GLOBAL.innodb_log_compressed_pages)
1 Expected
'#---------------------BS_STVARS_028_02----------------------#'
SET @@global.innodb_log_compressed_pages = 0;
Warnings:
Warning 138 The parameter innodb_log_compressed_pages is deprecated and has no effect.
SELECT @@global.innodb_log_compressed_pages;
@@global.innodb_log_compressed_pages
0
1
SET @@global.innodb_log_compressed_pages ='On' ;
Warnings:
Warning 138 The parameter innodb_log_compressed_pages is deprecated and has no effect.
SELECT @@global.innodb_log_compressed_pages;
@@global.innodb_log_compressed_pages
1
SET @@global.innodb_log_compressed_pages ='Off' ;
Warnings:
Warning 138 The parameter innodb_log_compressed_pages is deprecated and has no effect.
SELECT @@global.innodb_log_compressed_pages;
@@global.innodb_log_compressed_pages
0
1
SET @@global.innodb_log_compressed_pages = 1;
Warnings:
Warning 138 The parameter innodb_log_compressed_pages is deprecated and has no effect.
SELECT @@global.innodb_log_compressed_pages;
@@global.innodb_log_compressed_pages
1
......@@ -64,6 +72,8 @@ COUNT(@@GLOBAL.innodb_log_compressed_pages)
SELECT innodb_log_compressed_pages = @@SESSION.innodb_log_compressed_pages;
ERROR 42S22: Unknown column 'innodb_log_compressed_pages' in 'field list'
SET @@global.innodb_log_compressed_pages = @start_global_value;
Warnings:
Warning 138 The parameter innodb_log_compressed_pages is deprecated and has no effect.
SELECT @@global.innodb_log_compressed_pages;
@@global.innodb_log_compressed_pages
1
......@@ -1214,7 +1214,7 @@ SESSION_VALUE NULL
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.
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......
......@@ -1400,7 +1400,6 @@ btr_page_reorganize_low(
ulint max_ins_size2;
bool success = false;
ulint pos;
bool log_compressed;
bool is_spatial;
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
......@@ -1477,14 +1476,6 @@ btr_page_reorganize_low(
? page_is_leaf(temp_block->frame)
: block->page.id.page_no() == index->page));
/* If innodb_log_compressed_pages is ON, page reorganize should log the
compressed page image.*/
log_compressed = page_zip && page_zip_log_pages;
if (log_compressed) {
mtr_set_log_mode(mtr, log_mode);
}
if (page_zip
&& !page_zip_compress(block, index, z_level, mtr)) {
......@@ -1585,7 +1576,6 @@ btr_page_reorganize_low(
if (success) {
mlog_id_t type;
byte* log_ptr;
/* Write the log record */
if (page_zip) {
......@@ -1597,16 +1587,10 @@ btr_page_reorganize_low(
type = MLOG_PAGE_REORGANIZE;
}
log_ptr = log_compressed
? NULL
: mlog_open_and_write_index(
mtr, page, index, type,
page_zip ? 1 : 0);
/* For compressed pages write the compression level. */
if (log_ptr && page_zip) {
mach_write_to_1(log_ptr, z_level);
mlog_close(mtr, log_ptr + 1);
if (byte* log_ptr = mlog_open_and_write_index(
mtr, page, index, type, page_zip ? 1 : 0)) {
*log_ptr++ = z_level;
mlog_close(mtr, log_ptr);
}
MONITOR_INC(MONITOR_INDEX_REORG_SUCCESSFUL);
......
......@@ -3423,6 +3423,11 @@ static my_bool innodb_log_checksums;
static const char* innodb_log_checksums_deprecated
= "The parameter innodb_log_checksums is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static my_bool innodb_log_compressed_pages;
/** Deprecation message for innodb_log_compressed_pages */
static const char* innodb_log_compressed_pages_deprecated
= "The parameter innodb_log_compressed_pages is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static my_bool innodb_log_optimize_ddl;
static const char* innodb_log_optimize_ddl_deprecated
= "The parameter innodb_log_optimize_ddl is deprecated and has no effect.";
......@@ -3742,6 +3747,11 @@ static int innodb_init_params()
innodb_log_checksums = TRUE;
}
if (UNIV_UNLIKELY(!innodb_log_compressed_pages)) {
sql_print_warning(innodb_log_compressed_pages_deprecated);
innodb_log_compressed_pages = TRUE;
}
if (UNIV_UNLIKELY(innodb_log_optimize_ddl)) {
sql_print_warning(innodb_log_optimize_ddl_deprecated);
innodb_log_optimize_ddl = FALSE;
......@@ -18853,6 +18863,17 @@ innodb_log_checksums_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
innodb_log_checksums_deprecated);
}
/** Issue a deprecation warning for SET GLOBAL innodb_log_compressed_pages.
@param[in,out] thd client connection */
static void
innodb_log_compressed_pages_warn(THD* thd, st_mysql_sys_var*, void*,
const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
innodb_log_compressed_pages_deprecated);
}
/** Issue a deprecation warning for SET GLOBAL innodb_log_optimize_ddl.
@param[in,out] thd client connection */
static void
......@@ -19372,14 +19393,9 @@ static MYSQL_SYSVAR_UINT(compression_level, page_zip_level,
", 1 is fastest, 9 is best compression and default is 6.",
NULL, NULL, DEFAULT_COMPRESSION_LEVEL, 0, 9, 0);
static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages,
static MYSQL_SYSVAR_BOOL(log_compressed_pages, innodb_log_compressed_pages,
PLUGIN_VAR_OPCMDARG,
"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.",
NULL, NULL, TRUE);
innodb_deprecated_ignored, NULL, innodb_log_compressed_pages_warn, TRUE);
static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl,
PLUGIN_VAR_OPCMDARG,
......
......@@ -59,10 +59,6 @@ extern uint page_zip_level;
/** 'deleted' flag */
#define PAGE_ZIP_DIR_SLOT_DEL 0x8000U
/* Whether or not to log compressed page images to avoid possible
compression algorithm changes in zlib. */
extern my_bool page_zip_log_pages;
/**********************************************************************//**
Determine the size of a compressed page in bytes.
@return size in bytes */
......@@ -475,18 +471,6 @@ innodb_checksum_algorithm */
bool page_zip_verify_checksum(const void* data, ulint size);
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Write a log record of compressing an index page without the data on the page. */
UNIV_INLINE
void
page_zip_compress_write_log_no_data(
/*================================*/
ulint level, /*!< in: compression level */
buf_block_t* block, /*!< in: ROW_FORMAT=COMPRESSED index page */
dict_index_t* index, /*!< in: index */
mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull));
/**********************************************************************//**
Reset the counters used for filling
INFORMATION_SCHEMA.innodb_cmp_per_index. */
......
......@@ -362,27 +362,6 @@ page_zip_write_header(
}
}
/**********************************************************************//**
Write a log record of compressing an index page without the data on the page. */
UNIV_INLINE
void
page_zip_compress_write_log_no_data(
/*================================*/
ulint level, /*!< in: compression level */
buf_block_t* block, /*!< in: ROW_FORMAT=COMPRESSED index page */
dict_index_t* index, /*!< in: index */
mtr_t* mtr) /*!< in: mtr */
{
if (byte* log_ptr = mlog_open(mtr, 11 + 1)) {
log_ptr = mlog_write_initial_log_record_low(
MLOG_ZIP_PAGE_COMPRESS_NO_DATA,
block->page.id.space(), block->page.id.page_no(),
log_ptr, mtr);
mach_write_to_1(log_ptr, level);
mlog_close(mtr, log_ptr + 1);
}
}
/**********************************************************************//**
Reset the counters used for filling
INFORMATION_SCHEMA.innodb_cmp_per_index. */
......
......@@ -1629,7 +1629,6 @@ page_cur_insert_rec_zip(
rec_size, 1)
|| reorg_before_insert) {
/* The values can change dynamically. */
bool log_compressed = page_zip_log_pages;
ulint level = page_zip_level;
#ifdef UNIV_DEBUG
rec_t* cursor_rec = page_cur_get_rec(cursor);
......@@ -1664,9 +1663,6 @@ page_cur_insert_rec_zip(
} else if (!page_zip->m_nonempty && !page_has_garbage(page)) {
/* The page has been freshly compressed, so
reorganizing it will not help. */
} else if (log_compressed && !reorg_before_insert) {
/* Insert into uncompressed page only, and
try page_zip_reorganize() afterwards. */
} else if (btr_page_reorganize_low(
recv_recovery_is_on(), level,
cursor, index, mtr)) {
......@@ -1724,62 +1720,16 @@ page_cur_insert_rec_zip(
ulint pos = page_rec_get_n_recs_before(insert_rec);
ut_ad(pos > 0);
if (!log_compressed) {
const mtr_log_t log_mode = mtr->set_log_mode(
MTR_LOG_NONE);
const bool ok = page_zip_compress(
page_cur_get_block(cursor),
index, level, mtr);
mtr->set_log_mode(log_mode);
if (ok) {
page_cur_insert_rec_write_log(
insert_rec, rec_size,
cursor->rec, index, mtr);
page_zip_compress_write_log_no_data(
level,
page_cur_get_block(cursor),
index, mtr);
rec_offs_make_valid(
insert_rec, index,
page_is_leaf(page), offsets);
return(insert_rec);
}
/* Page compress failed. If this happened on a
leaf page, put the data size into the sample
buffer. */
if (page_is_leaf(page)) {
ulint occupied = page_get_data_size(page)
+ page_dir_calc_reserved_space(
page_get_n_recs(page));
index->stat_defrag_data_size_sample[
index->stat_defrag_sample_next_slot] =
occupied;
index->stat_defrag_sample_next_slot =
(index->stat_defrag_sample_next_slot
+ 1) % STAT_DEFRAG_DATA_SIZE_N_SAMPLE;
}
ut_ad(cursor->rec
== (pos > 1
? page_rec_get_nth(
page, pos - 1)
: page + PAGE_NEW_INFIMUM));
} else {
/* We are writing entire page images
to the log. Reduce the redo log volume
by reorganizing the page at the same time. */
if (page_zip_reorganize(
cursor->block, index, mtr)) {
/* The page was reorganized:
Seek to pos. */
/* We are writing entire page images to the
log. Reduce the redo log volume by
reorganizing the page at the same time. */
if (page_zip_reorganize(cursor->block, index, mtr)) {
/* The page was reorganized: Seek to pos. */
if (pos > 1) {
cursor->rec = page_rec_get_nth(
page, pos - 1);
} else {
cursor->rec = page
+ PAGE_NEW_INFIMUM;
cursor->rec = page + PAGE_NEW_INFIMUM;
}
insert_rec = page + rec_get_next_offs(
......@@ -1790,15 +1740,13 @@ page_cur_insert_rec_zip(
return(insert_rec);
}
/* Theoretically, we could try one
last resort of btr_page_reorganize_low()
followed by page_zip_available(), but
that would be very unlikely to
succeed. (If the full reorganized page
failed to compress, why would it
succeed to compress the page, plus log
the insert of this record? */
}
/* Theoretically, we could try one last resort
of btr_page_reorganize_low() followed by
page_zip_available(), but that would be very
unlikely to succeed. (If the full reorganized
page failed to compress, why would it succeed
to compress the page, plus log the insert of
this record?) */
/* Out of space: restore the page */
if (!page_zip_decompress(page_zip, page, FALSE)) {
......
......@@ -62,10 +62,6 @@ page_zip_stat_per_index_t page_zip_stat_per_index;
/** Compression level to be used by zlib. Settable by user. */
uint page_zip_level;
/** Whether or not to log compressed page images to avoid possible
compression algorithm changes in zlib. */
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