1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Remove the debug variables innodb_purge_stop_now, innodb_purge_run_now

The InnoDB purge subsystem can be best stopped by opening a read view,
for example by START TRANSACTION WITH CONSISTENT SNAPSHOT.

To ensure that everything is purged, use wait_all_purged.inc,
which waits for the History list length in SHOW ENGINE INNODB STATUS
to reach 0. Setting innodb_purge_run_now never guaranteed this.
This commit is contained in:
Marko Mäkelä
2017-09-13 11:04:49 +03:00
parent d06e4fc6a3
commit 24062fed70
10 changed files with 28 additions and 256 deletions

View File

@ -494,7 +494,9 @@ c4 VARCHAR(2048),
INDEX idx1(c2), INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB; INDEX idx3(c4(512))) Engine=InnoDB;
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
@ -659,7 +661,10 @@ FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0; WHERE name = 'ibuf_merges_inserts' AND count > 0;
name name
SET GLOBAL innodb_disable_background_merge=OFF; SET GLOBAL innodb_disable_background_merge=OFF;
SET GLOBAL INNODB_PURGE_RUN_NOW=ON; connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 ( CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,

View File

@ -1055,7 +1055,9 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx3(c4(512))) Engine=InnoDB; INDEX idx3(c4(512))) Engine=InnoDB;
# Stop purge so that it doesn't remove the delete marked entries. # Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
# Disable change buffer merge from the master thread, additionally # Disable change buffer merge from the master thread, additionally
# enable aggressive flushing so that more changes are buffered. # enable aggressive flushing so that more changes are buffered.
@ -1125,7 +1127,10 @@ SELECT name
SET GLOBAL innodb_disable_background_merge=OFF; SET GLOBAL innodb_disable_background_merge=OFF;
# Enable normal operation # Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON; connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;

View File

@ -123,7 +123,9 @@ INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED; ROW_FORMAT=COMPRESSED;
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
@ -288,7 +290,10 @@ FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0; WHERE name = 'ibuf_merges_inserts' AND count > 0;
name name
SET GLOBAL innodb_disable_background_merge=OFF; SET GLOBAL innodb_disable_background_merge=OFF;
SET GLOBAL INNODB_PURGE_RUN_NOW=ON; connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 ( CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,

View File

@ -321,7 +321,9 @@ CREATE TABLE test_wl5522.t1 (
ROW_FORMAT=COMPRESSED; ROW_FORMAT=COMPRESSED;
# Stop purge so that it doesn't remove the delete marked entries. # Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
# Disable change buffer merge from the master thread, additionally # Disable change buffer merge from the master thread, additionally
# enable aggressive flushing so that more changes are buffered. # enable aggressive flushing so that more changes are buffered.
@ -391,7 +393,10 @@ SELECT name
SET GLOBAL innodb_disable_background_merge=OFF; SET GLOBAL innodb_disable_background_merge=OFF;
# Enable normal operation # Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON; connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;

View File

@ -1,27 +0,0 @@
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 0
purge_resume_count 0
SET @orig = @@global.innodb_purge_run_now;
SELECT @orig;
@orig
0
SET GLOBAL innodb_purge_stop_now = ON;
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 1
purge_resume_count 0
SET GLOBAL innodb_purge_run_now = ON;
SELECT @@global.innodb_purge_run_now;
@@global.innodb_purge_run_now
0
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 1
purge_resume_count 1

View File

@ -1,27 +0,0 @@
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 0
purge_resume_count 0
SET @orig = @@global.innodb_purge_run_now;
SELECT @orig;
@orig
0
SET GLOBAL innodb_purge_stop_now = ON;
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 1
purge_resume_count 0
SET GLOBAL innodb_purge_run_now = ON;
SELECT @@global.innodb_purge_run_now;
@@global.innodb_purge_run_now
0
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
name count
purge_stop_count 1
purge_resume_count 1

View File

@ -2274,34 +2274,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_PURGE_RUN_NOW
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Set purge state to RUN
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_PURGE_STOP_NOW
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Set purge state to STOP
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_PURGE_THREADS VARIABLE_NAME INNODB_PURGE_THREADS
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE 4 GLOBAL_VALUE 4

View File

@ -1,53 +0,0 @@
#
# Basic test for innodb_purge_run_now, note it is a duplicate of
# innodb_purge_stop_now.
#
-- source include/have_innodb.inc
# The config variable is a debug variable for now
-- source include/have_debug.inc
--disable_query_log
# Enable metrics for the counters we are going to use
set global innodb_monitor_enable = purge_stop_count;
set global innodb_monitor_enable = purge_resume_count;
--enable_query_log
# Should be 0 for both
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
# Check the default value
SET @orig = @@global.innodb_purge_run_now;
SELECT @orig;
# Stop of purge
SET GLOBAL innodb_purge_stop_now = ON;
# Stop count should now be 1
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
SET GLOBAL innodb_purge_run_now = ON;
# Should always be OFF
SELECT @@global.innodb_purge_run_now;
# Both should be 1 now
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
--disable_query_log
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
-- disable_warnings
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
-- enable_warnings

View File

@ -1,53 +0,0 @@
#
# Basic test for innodb_purge_run_now, note it is a duplicate of
# innodb_purge_stop_now.
#
-- source include/have_innodb.inc
# The config variable is a debug variable for now
-- source include/have_debug.inc
--disable_query_log
# Enable metrics for the counters we are going to use
set global innodb_monitor_enable = purge_stop_count;
set global innodb_monitor_enable = purge_resume_count;
--enable_query_log
# Should be 0 for both
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
# Check the default value
SET @orig = @@global.innodb_purge_run_now;
SELECT @orig;
# Stop of purge
SET GLOBAL innodb_purge_stop_now = ON;
# Stop count should now be 1
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
SET GLOBAL innodb_purge_run_now = ON;
# Should always be OFF
SELECT @@global.innodb_purge_run_now;
# Both should be 1 now
SELECT name, count
FROM information_schema.innodb_metrics
WHERE name = 'purge_stop_count' OR name = 'purge_resume_count';
--disable_query_log
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
-- disable_warnings
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
-- enable_warnings

View File

@ -19750,8 +19750,6 @@ innobase_fts_find_ranking(FT_INFO* fts_hdl, uchar*, uint)
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
static my_bool innodb_background_drop_list_empty = TRUE; static my_bool innodb_background_drop_list_empty = TRUE;
static my_bool innodb_purge_run_now = TRUE;
static my_bool innodb_purge_stop_now = TRUE;
static my_bool innodb_log_checkpoint_now = TRUE; static my_bool innodb_log_checkpoint_now = TRUE;
static my_bool innodb_buf_flush_list_now = TRUE; static my_bool innodb_buf_flush_list_now = TRUE;
static uint innodb_merge_threshold_set_all_debug static uint innodb_merge_threshold_set_all_debug
@ -19775,52 +19773,6 @@ wait_background_drop_list_empty(
row_wait_for_background_drop_list_empty(); row_wait_for_background_drop_list_empty();
} }
/****************************************************************//**
Set the purge state to RUN. If purge is disabled then it
is a no-op. This function is registered as a callback with MySQL. */
static
void
purge_run_now_set(
/*==============*/
THD* thd /*!< in: thread handle */
MY_ATTRIBUTE((unused)),
struct st_mysql_sys_var* var /*!< in: pointer to system
variable */
MY_ATTRIBUTE((unused)),
void* var_ptr /*!< out: where the formal
string goes */
MY_ATTRIBUTE((unused)),
const void* save) /*!< in: immediate result from
check function */
{
if (*(my_bool*) save && trx_purge_state() != PURGE_STATE_DISABLED) {
trx_purge_run();
}
}
/****************************************************************//**
Set the purge state to STOP. If purge is disabled then it
is a no-op. This function is registered as a callback with MySQL. */
static
void
purge_stop_now_set(
/*===============*/
THD* thd /*!< in: thread handle */
MY_ATTRIBUTE((unused)),
struct st_mysql_sys_var* var /*!< in: pointer to system
variable */
MY_ATTRIBUTE((unused)),
void* var_ptr /*!< out: where the formal
string goes */
MY_ATTRIBUTE((unused)),
const void* save) /*!< in: immediate result from
check function */
{
if (*(my_bool*) save && trx_purge_state() != PURGE_STATE_DISABLED) {
trx_purge_stop();
}
}
/****************************************************************//** /****************************************************************//**
Force innodb to checkpoint. */ Force innodb to checkpoint. */
static static
@ -20629,16 +20581,6 @@ static MYSQL_SYSVAR_BOOL(background_drop_list_empty,
"Wait for the background drop list to become empty", "Wait for the background drop list to become empty",
NULL, wait_background_drop_list_empty, FALSE); NULL, wait_background_drop_list_empty, FALSE);
static MYSQL_SYSVAR_BOOL(purge_run_now, innodb_purge_run_now,
PLUGIN_VAR_OPCMDARG,
"Set purge state to RUN",
NULL, purge_run_now_set, FALSE);
static MYSQL_SYSVAR_BOOL(purge_stop_now, innodb_purge_stop_now,
PLUGIN_VAR_OPCMDARG,
"Set purge state to STOP",
NULL, purge_stop_now_set, FALSE);
static MYSQL_SYSVAR_BOOL(log_checkpoint_now, innodb_log_checkpoint_now, static MYSQL_SYSVAR_BOOL(log_checkpoint_now, innodb_log_checkpoint_now,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Force checkpoint now", "Force checkpoint now",
@ -21912,8 +21854,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(purge_batch_size), MYSQL_SYSVAR(purge_batch_size),
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
MYSQL_SYSVAR(background_drop_list_empty), MYSQL_SYSVAR(background_drop_list_empty),
MYSQL_SYSVAR(purge_run_now),
MYSQL_SYSVAR(purge_stop_now),
MYSQL_SYSVAR(log_checkpoint_now), MYSQL_SYSVAR(log_checkpoint_now),
MYSQL_SYSVAR(buf_flush_list_now), MYSQL_SYSVAR(buf_flush_list_now),
MYSQL_SYSVAR(merge_threshold_set_all_debug), MYSQL_SYSVAR(merge_threshold_set_all_debug),