Skip to content

Commit

Permalink
MDEV-19514 preparation: Remove innodb_change_buffering_debug=2
Browse files Browse the repository at this point in the history
The setting innodb_change_buffering_debug=2 was supposed to inject
a crash during change buffer merge. There is no public test for
that functionality, and even if there were, it would be better
to use DEBUG_SYNC to halt the thread that does change buffer merge,
force a redo log flush from another thread, and finally kill the
server externally.
  • Loading branch information
dr-m committed Sep 9, 2019
1 parent 2336e0b commit 43a6e81
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Warnings:
Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2'
set global innodb_change_buffering_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
set global innodb_change_buffering_debug=2;
Warnings:
Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2'
select @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
1
SET @@global.innodb_change_buffering_debug = @start_global_value;
SELECT @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/sys_vars/r/sysvars_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Debug flags for InnoDB change buffering (0=none, 2=crash at merge)
VARIABLE_COMMENT Debug flags for InnoDB change buffering (0=none, 1=try to buffer)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
NUMERIC_MAX_VALUE 1
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ set global innodb_change_buffering_debug='foo';
set global innodb_change_buffering_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_change_buffering_debug=1e1;
# The value 2 is supposed to kill the server if there are unmerged changes.
# Do not try to set the value to 2 or anything that can be clamped to 2.
#set global innodb_change_buffering_debug=2;
set global innodb_change_buffering_debug=2;
select @@global.innodb_change_buffering_debug;

#
# Cleanup
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20616,8 +20616,8 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method,
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
PLUGIN_VAR_RQCMDARG,
"Debug flags for InnoDB change buffering (0=none, 2=crash at merge)",
NULL, NULL, 0, 0, 2, 0);
"Debug flags for InnoDB change buffering (0=none, 1=try to buffer)",
NULL, NULL, 0, 0, 1, 0);

static MYSQL_SYSVAR_BOOL(disable_background_merge,
srv_ibuf_disable_background_merge,
Expand Down
17 changes: 0 additions & 17 deletions storage/innobase/ibuf/ibuf0ibuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4241,23 +4241,6 @@ ibuf_delete_rec(
ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no);
ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space);

#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
if (ibuf_debug == 2) {
/* Inject a fault (crash). We do this before trying
optimistic delete, because a pessimistic delete in the
change buffer would require a larger test case. */

/* Flag the buffered record as processed, to avoid
an assertion failure after crash recovery. */
btr_cur_set_deleted_flag_for_ibuf(
btr_pcur_get_rec(pcur), NULL, TRUE, mtr);

ibuf_mtr_commit(mtr);
log_write_up_to(LSN_MAX, true);
DBUG_SUICIDE();
}
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */

success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur),
0, mtr);

Expand Down

0 comments on commit 43a6e81

Please sign in to comment.