Skip to content

Commit

Permalink
Remove the debug variables innodb_purge_stop_now, innodb_purge_run_now
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Sep 13, 2017
1 parent d06e4fc commit 24062fe
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 256 deletions.
9 changes: 7 additions & 2 deletions mysql-test/suite/innodb/r/innodb-wl5522-debug.result
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
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_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
Expand Down Expand Up @@ -659,7 +661,10 @@ FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
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;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down
9 changes: 7 additions & 2 deletions mysql-test/suite/innodb/t/innodb-wl5522-debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,9 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx3(c4(512))) Engine=InnoDB;

# 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
# enable aggressive flushing so that more changes are buffered.
Expand Down Expand Up @@ -1125,7 +1127,10 @@ SELECT name
SET GLOBAL innodb_disable_background_merge=OFF;

# Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
connection purge_control;
COMMIT;
disconnect purge_control;
connection default;

DROP TABLE test_wl5522.t1;

Expand Down
9 changes: 7 additions & 2 deletions mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
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_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
Expand Down Expand Up @@ -288,7 +290,10 @@ FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
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;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down
9 changes: 7 additions & 2 deletions mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ CREATE TABLE test_wl5522.t1 (
ROW_FORMAT=COMPRESSED;

# 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
# enable aggressive flushing so that more changes are buffered.
Expand Down Expand Up @@ -391,7 +393,10 @@ SELECT name
SET GLOBAL innodb_disable_background_merge=OFF;

# Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
connection purge_control;
COMMIT;
disconnect purge_control;
connection default;

DROP TABLE test_wl5522.t1;

Expand Down
27 changes: 0 additions & 27 deletions mysql-test/suite/sys_vars/r/innodb_purge_run_now_basic.result

This file was deleted.

27 changes: 0 additions & 27 deletions mysql-test/suite/sys_vars/r/innodb_purge_stop_now_basic.result

This file was deleted.

28 changes: 0 additions & 28 deletions mysql-test/suite/sys_vars/r/sysvars_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -2274,34 +2274,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
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
SESSION_VALUE NULL
GLOBAL_VALUE 4
Expand Down
53 changes: 0 additions & 53 deletions mysql-test/suite/sys_vars/t/innodb_purge_run_now_basic.test

This file was deleted.

53 changes: 0 additions & 53 deletions mysql-test/suite/sys_vars/t/innodb_purge_stop_now_basic.test

This file was deleted.

60 changes: 0 additions & 60 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19750,8 +19750,6 @@ innobase_fts_find_ranking(FT_INFO* fts_hdl, uchar*, uint)

#ifdef UNIV_DEBUG
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_buf_flush_list_now = TRUE;
static uint innodb_merge_threshold_set_all_debug
Expand All @@ -19775,52 +19773,6 @@ wait_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. */
static
Expand Down Expand Up @@ -20629,16 +20581,6 @@ static MYSQL_SYSVAR_BOOL(background_drop_list_empty,
"Wait for the background drop list to become empty",
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,
PLUGIN_VAR_OPCMDARG,
"Force checkpoint now",
Expand Down Expand Up @@ -21912,8 +21854,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(purge_batch_size),
#ifdef UNIV_DEBUG
MYSQL_SYSVAR(background_drop_list_empty),
MYSQL_SYSVAR(purge_run_now),
MYSQL_SYSVAR(purge_stop_now),
MYSQL_SYSVAR(log_checkpoint_now),
MYSQL_SYSVAR(buf_flush_list_now),
MYSQL_SYSVAR(merge_threshold_set_all_debug),
Expand Down

0 comments on commit 24062fe

Please sign in to comment.