diff --git a/mysql-test/suite/encryption/r/innodb-scrub-log.result b/mysql-test/suite/encryption/r/innodb-scrub-log.result deleted file mode 100644 index 8ea75000368..00000000000 --- a/mysql-test/suite/encryption/r/innodb-scrub-log.result +++ /dev/null @@ -1,3 +0,0 @@ -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; diff --git a/mysql-test/suite/encryption/t/innodb-scrub-log.opt b/mysql-test/suite/encryption/t/innodb-scrub-log.opt deleted file mode 100644 index 0078065bbf7..00000000000 --- a/mysql-test/suite/encryption/t/innodb-scrub-log.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb-scrub-log=on diff --git a/mysql-test/suite/encryption/t/innodb-scrub-log.test b/mysql-test/suite/encryption/t/innodb-scrub-log.test deleted file mode 100644 index e8149b6b3ff..00000000000 --- a/mysql-test/suite/encryption/t/innodb-scrub-log.test +++ /dev/null @@ -1,13 +0,0 @@ ---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; diff --git a/mysql-test/suite/sys_vars/r/innodb_scrub_log_speed_basic.result b/mysql-test/suite/sys_vars/r/innodb_scrub_log_speed_basic.result index e51dab0718a..c9b46cc0c95 100644 --- a/mysql-test/suite/sys_vars/r/innodb_scrub_log_speed_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_scrub_log_speed_basic.result @@ -3,12 +3,16 @@ SELECT @@GLOBAL.innodb_scrub_log_speed; 256 200 Expected SET @@GLOBAL.innodb_scrub_log_speed=100; +Warnings: +Warning 138 The parameter innodb_scrub_log_speed is deprecated and has no effect. 1 Expected SELECT @@GLOBAL.innodb_scrub_log_speed; @@GLOBAL.innodb_scrub_log_speed -100 +256 100 Expected SET @@GLOBAL.innodb_scrub_log_speed=DEFAULT; +Warnings: +Warning 138 The parameter innodb_scrub_log_speed is deprecated and has no effect. 1 Expected SELECT @@GLOBAL.innodb_scrub_log_speed; @@GLOBAL.innodb_scrub_log_speed diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index dcdafc8196d..8a7b35eb953 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1682,7 +1682,7 @@ SESSION_VALUE NULL DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enable background redo log scrubbing +VARIABLE_COMMENT Deprecated parameter with no effect. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -1694,7 +1694,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Background redo log scrubbing speed in bytes/sec +VARIABLE_COMMENT Deprecated parameter with no effect. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 50000 NUMERIC_BLOCK_SIZE 0 diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 38d7299923a..6cd83d180ed 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1094,7 +1094,6 @@ static SHOW_VAR innodb_status_variables[]= { &export_vars.innodb_scrub_page_split_failures_missing_index, SHOW_SIZE_T}, {"scrub_background_page_split_failures_unknown", &export_vars.innodb_scrub_page_split_failures_unknown, SHOW_SIZE_T}, - {"scrub_log", &export_vars.innodb_scrub_log, SHOW_LONGLONG}, {"encryption_num_key_requests", &export_vars.innodb_encryption_key_requests, SHOW_LONGLONG}, @@ -3432,7 +3431,16 @@ static const char* innodb_log_compressed_pages_msg static my_bool innodb_log_optimize_ddl; static const char* innodb_log_optimize_ddl_msg = "The parameter innodb_log_optimize_ddl is deprecated and has no effect."; - +/** Deprecated parameter with no effect */ +static my_bool innodb_scrub_log; +/** Deprecation message for innodb_scrub_log */ +static const char* innodb_scrub_log_msg += "The parameter innodb_scrub_log is deprecated and has no effect."; +/** Deprecated parameter with no effect */ +static ulonglong innodb_scrub_log_speed; +/** Deprecation message for innodb_scrub_log_speed */ +static const char* innodb_scrub_log_speed_msg += "The parameter innodb_scrub_log_speed is deprecated and has no effect."; /** Deprecated parameter with no effect */ static ulong innodb_undo_logs; /** Deprecation message for innodb_undo_logs */ @@ -3761,6 +3769,16 @@ static int innodb_init_params() deprecated::innodb_log_optimize_ddl = FALSE; } + if (UNIV_UNLIKELY(deprecated::innodb_scrub_log)) { + sql_print_warning(deprecated::innodb_scrub_log_msg); + deprecated::innodb_scrub_log = FALSE; + } + + if (UNIV_UNLIKELY(deprecated::innodb_scrub_log_speed != 256)) { + sql_print_warning(deprecated::innodb_scrub_log_speed_msg); + deprecated::innodb_scrub_log_speed = 256; + } + if (UNIV_UNLIKELY(deprecated::innodb_buffer_pool_instances)) { sql_print_warning("The parameter innodb_buffer_pool_instances" " is deprecated and has no effect."); @@ -18906,6 +18924,16 @@ innodb_undo_logs_warn(THD* thd, st_mysql_sys_var*, void*, const void*) deprecated::innodb_undo_logs_msg); } +/** Issue a deprecation warning for SET GLOBAL innodb_scrub_log_speed. +@param[in,out] thd client connection */ +static void +innodb_scrub_log_speed_warn(THD* thd, st_mysql_sys_var*, void*, const void*) +{ + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + deprecated::innodb_scrub_log_speed_msg); +} + static SHOW_VAR innodb_status_variables_export[]= { {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, {NullS, NullS, SHOW_LONG} @@ -20147,18 +20175,15 @@ static MYSQL_SYSVAR_UINT(encryption_rotation_iops, srv_n_fil_crypt_iops, innodb_encryption_rotation_iops_update, srv_n_fil_crypt_iops, 0, UINT_MAX32, 0); -static MYSQL_SYSVAR_BOOL(scrub_log, srv_scrub_log, +static MYSQL_SYSVAR_BOOL(scrub_log, deprecated::innodb_scrub_log, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, - "Enable background redo log scrubbing", + innodb_deprecated_ignored, 0, 0, 0); -static MYSQL_SYSVAR_ULONGLONG(scrub_log_speed, innodb_scrub_log_speed, +static MYSQL_SYSVAR_ULONGLONG(scrub_log_speed, deprecated::innodb_scrub_log_speed, PLUGIN_VAR_OPCMDARG, - "Background redo log scrubbing speed in bytes/sec", - NULL, NULL, - 256, /* 256 bytes/sec, corresponds to 2000 ms scrub_log_interval */ - 1, /* min */ - 50000, 0); /* 50Kbyte/sec, corresponds to 10 ms scrub_log_interval */ + innodb_deprecated_ignored, NULL, innodb_scrub_log_speed_warn, + 256, 1, 50000, 0); static MYSQL_SYSVAR_BOOL(encrypt_log, srv_encrypt_log, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index e8aead05af5..5911855d90c 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -875,15 +875,6 @@ inline void log_t::file::set_lsn_offset(lsn_t a_lsn) { /** Release the log sys mutex. */ #define log_mutex_exit() mutex_exit(&log_sys.mutex) - -/* log scrubbing speed, in bytes/sec */ -extern ulonglong innodb_scrub_log_speed; - -/** Event to wake up log_scrub_thread */ -extern os_event_t log_scrub_event; -/** Whether log_scrub_thread is active */ -extern bool log_scrub_thread_active; - #include "log0log.ic" #endif diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 0ebd71b2bf5..ef9db3ee2a6 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -185,9 +185,6 @@ 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; - /** Number of spaces in keyrotation list */ ulint_ctr_64_t key_rotation_list_length; @@ -483,9 +480,6 @@ extern ibool srv_print_verbose_log; extern bool srv_monitor_active; -/* TRUE if enable log scrubbing */ -extern my_bool srv_scrub_log; - extern ulong srv_n_spin_wait_rounds; extern ulong srv_n_free_tickets_to_enter; extern ulong srv_thread_sleep_delay; @@ -971,7 +965,6 @@ 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. */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 8d1175cba85..86c2ddf8464 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -66,10 +66,6 @@ to the InnoDB redo log. */ /** Redo log system */ log_t log_sys; -/* Next log block number to do dummy record filling if no log records written -for a while */ -static ulint next_lbn_to_pad = 0; - /* These control how often we print warnings if the last checkpoint is too old */ static bool log_has_printed_chkp_warning = false; @@ -102,15 +98,6 @@ the previous */ #define LOG_UNLOCK_NONE_FLUSHED_LOCK 1 #define LOG_UNLOCK_FLUSH_LOCK 2 -/** Event to wake up log_scrub_thread */ -os_event_t log_scrub_event; -/** Whether log_scrub_thread is active */ -bool log_scrub_thread_active; - -extern "C" UNIV_INTERN -os_thread_ret_t -DECLARE_THREAD(log_scrub_thread)(void*); - /****************************************************************//** Returns the oldest modified block lsn in the pool, or log_sys.lsn if none exists. @@ -553,12 +540,6 @@ void log_t::create() buf_free= LOG_BLOCK_HDR_SIZE; lsn= LOG_START_LSN + LOG_BLOCK_HDR_SIZE; - - log_scrub_thread_active= !srv_read_only_mode && srv_scrub_log; - if (log_scrub_thread_active) { - log_scrub_event= os_event_create("log_scrub_event"); - os_thread_create(log_scrub_thread, NULL, NULL); - } } mapped_file_t::~mapped_file_t() noexcept @@ -1766,18 +1747,13 @@ wait_suspend_loop: } } - if (log_scrub_thread_active) { - ut_ad(!srv_read_only_mode); - os_event_set(log_scrub_event); - } - if (log_sys.is_initialised()) { log_mutex_enter(); const ulint n_write = log_sys.n_pending_checkpoint_writes; const ulint n_flush = log_sys.pending_flushes; log_mutex_exit(); - if (log_scrub_thread_active || n_write || n_flush) { + if (n_write || n_flush) { if (srv_print_verbose_log && count > 600) { ib::info() << "Pending checkpoint_writes: " << n_write @@ -1789,8 +1765,6 @@ wait_suspend_loop: } } - ut_ad(!log_scrub_thread_active); - if (!buf_pool) { ut_ad(!srv_was_started); } else if (ulint pending_io = buf_pool_check_no_pending_io()) { @@ -1989,104 +1963,9 @@ void log_t::close() mutex_free(&mutex); mutex_free(&log_flush_order_mutex); - if (!srv_read_only_mode && srv_scrub_log) - os_event_destroy(log_scrub_event); - recv_sys.close(); } -/******************************************************//** -Pads the current log block full with dummy log records. Used in producing -consistent archived log file and scrubbing redo log. */ -static -void -log_pad_current_log_block(void) -/*===========================*/ -{ - byte b = 0; - ulint pad_length; - ulint i; - lsn_t lsn; - - ut_ad(!recv_no_log_write); - /* We retrieve lsn only because otherwise gcc crashed on HP-UX */ - lsn = log_reserve_and_open(OS_FILE_LOG_BLOCK_SIZE); - - pad_length = log_sys.trailer_offset() - - log_sys.buf_free % OS_FILE_LOG_BLOCK_SIZE; - if (pad_length == log_sys.payload_size()) { - pad_length = 0; - } - - if (pad_length) { - srv_stats.n_log_scrubs.inc(); - } - - for (i = 0; i < pad_length; i++) { - log_write_low(&b, 1); - } - - lsn = log_sys.lsn; - - log_close(); - - ut_a(lsn % OS_FILE_LOG_BLOCK_SIZE == LOG_BLOCK_HDR_SIZE); -} - -/*****************************************************************//* -If no log record has been written for a while, fill current log -block with dummy records. */ -static -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) - { - log_pad_current_log_block(); - } - - next_lbn_to_pad = log_block_convert_lsn_to_no(log_sys.lsn); - log_mutex_exit(); -} - -/* log scrubbing speed, in bytes/sec */ -UNIV_INTERN ulonglong innodb_scrub_log_speed; - -/*****************************************************************//** -This is the main thread for log scrub. It waits for an event and -when waked up fills current log block with dummy records and -sleeps again. -@return this function does not return, it calls os_thread_exit() */ -extern "C" UNIV_INTERN -os_thread_ret_t -DECLARE_THREAD(log_scrub_thread)(void*) -{ - ut_ad(!srv_read_only_mode); - - while (srv_shutdown_state < SRV_SHUTDOWN_FLUSH_PHASE) { - /* log scrubbing interval in µs. */ - ulonglong interval = 1000*1000*512/innodb_scrub_log_speed; - - os_event_wait_time(log_scrub_event, static_cast(interval)); - - log_scrub(); - - os_event_reset(log_scrub_event); - } - - log_scrub_thread_active = false; - - /* We count the number of threads in os_thread_exit(). A created - thread should always use that to exit and not use return() to exit. */ - os_thread_exit(); - - OS_THREAD_DUMMY_RETURN; -} - std::string get_log_file_path(const char *filename) { const size_t size= strlen(srv_log_group_home_dir) + /* path separator */ 1 + diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 404140a7872..25b01daa2e0 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -84,8 +84,6 @@ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPH in microseconds, in order to reduce the lagging of the purge thread. */ ulint srv_dml_needed_delay; -my_bool srv_scrub_log; - const char* srv_main_thread_op_info = ""; /** Prefix used by MySQL to indicate pre-5.1 table name encoding */ @@ -1361,7 +1359,6 @@ 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); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c07185ddc98..40a825f558d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -892,10 +892,6 @@ srv_shutdown_all_bg_threads() if (srv_n_fil_crypt_threads_started) { os_event_set(fil_crypt_threads_event); } - - if (log_scrub_thread_active) { - os_event_set(log_scrub_event); - } } if (srv_start_state_is_set(SRV_START_STATE_IO)) {