Commit 403f6e96 authored by Jan Lindström's avatar Jan Lindström

MDEV-11705: InnoDB: Failing assertion: (&log_sys->mutex)->is_owned() if server...

MDEV-11705: InnoDB: Failing assertion: (&log_sys->mutex)->is_owned() if server started with innodb-scrub-log

Problem was that log_scrub function did not take required log_sys mutex.

Background: Unused space in log blocks are padded with MLOG_DUMMY_RECORD if innodb-scrub-log
is enabled. As log files are written on circular fashion old log blocks can be reused
later for new redo-log entries. Scrubbing pads unused space in log blocks to avoid visibility
of the possible old redo-log contents.

log_scrub(): Take log_sys mutex

log_pad_current_log_block(): Increase srv_stats.n_log_scrubs if padding is done.

srv0srv.cc: Set srv_stats.n_log_scrubs to export vars innodb_scrub_log

ha_innodb.cc: Export innodb_scrub_log to global status.
parent 4c610d10
create table t1(a int not null primary key auto_increment,
b varchar(200), c char(100), d varchar(150)) engine=innodb;
DROP TABLE t1;
--source include/have_innodb.inc
#
# MDEV-11705: InnoDB: Failing assertion: (&log_sys->mutex)->is_owned() if server started with innodb-scrub-log
#
create table t1(a int not null primary key auto_increment,
b varchar(200), c char(100), d varchar(150)) engine=innodb;
let $wait_condition= SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'innodb_scrub_log';
--source include/wait_condition.inc
DROP TABLE t1;
......@@ -1273,6 +1273,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"scrub_background_page_split_failures_unknown",
(char*) &export_vars.innodb_scrub_page_split_failures_unknown,
SHOW_LONG},
{"scrub_log",
(char*) &export_vars.innodb_scrub_log,
SHOW_LONGLONG},
{"encryption_num_key_requests",
(char*) &export_vars.innodb_encryption_key_requests, SHOW_LONGLONG},
......
......@@ -3,7 +3,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2016, MariaDB Corporation
Copyright (c) 2013, 2017, MariaDB Corporation
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -194,6 +194,9 @@ struct srv_stats_t {
/** Number of encryption_get_latest_key_version calls */
ulint_ctr_64_t n_key_requests;
/** Number of log scrub operations */
ulint_ctr_64_t n_log_scrubs;
};
extern const char* srv_main_thread_op_info;
......@@ -1118,6 +1121,7 @@ struct export_var_t{
ulint innodb_scrub_page_split_failures_out_of_filespace;
ulint innodb_scrub_page_split_failures_missing_index;
ulint innodb_scrub_page_split_failures_unknown;
int64_t innodb_scrub_log;
};
/** Thread slot in the thread table. */
......
......@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -2552,6 +2552,10 @@ log_pad_current_log_block(void)
pad_length = 0;
}
if (pad_length) {
srv_stats.n_log_scrubs.inc();
}
for (i = 0; i < pad_length; i++) {
log_write_low(&b, 1);
}
......@@ -2571,6 +2575,7 @@ void
log_scrub()
/*=========*/
{
log_mutex_enter();
ulint cur_lbn = log_block_convert_lsn_to_no(log_sys->lsn);
if (next_lbn_to_pad == cur_lbn)
......@@ -2579,6 +2584,7 @@ log_scrub()
}
next_lbn_to_pad = log_block_convert_lsn_to_no(log_sys->lsn);
log_mutex_exit();
}
/* log scrubbing speed, in bytes/sec */
......
......@@ -1705,6 +1705,7 @@ srv_export_innodb_status(void)
scrub_stat.page_split_failures_missing_index;
export_vars.innodb_scrub_page_split_failures_unknown =
scrub_stat.page_split_failures_unknown;
export_vars.innodb_scrub_log = srv_stats.n_log_scrubs;
mutex_exit(&srv_innodb_monitor_mutex);
}
......
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