From b393e2cb0c079b30563dcc87a62002c9c778643c Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Thu, 25 Jul 2019 22:17:04 +1000 Subject: add innodb_debug_sync var to support DEBUG_SYNC from purge threads --- storage/innobase/handler/ha_innodb.cc | 41 ++++++++++++++++- storage/innobase/include/que0que.h | 3 ++ storage/innobase/include/srv0srv.h | 20 +++++++++ storage/innobase/include/trx0purge.h | 7 ++- storage/innobase/que/que0que.cc | 3 ++ storage/innobase/row/row0purge.cc | 20 +++++++++ storage/innobase/srv/srv0srv.cc | 85 ++++++++++++++++++++++++++++++----- storage/innobase/trx/trx0purge.cc | 8 +++- 8 files changed, 174 insertions(+), 13 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 3267983c89f..df8e0c5ee10 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19376,6 +19376,33 @@ innodb_log_checksums_update( thd, *static_cast(save)); } +#ifdef UNIV_DEBUG +static +void +innobase_debug_sync_callback(srv_slot_t *slot, const void *value) +{ + const char *value_str = *static_cast(value); + size_t len = strlen(value_str) + 1; + + + // One allocatoin for list node object and value. + void *buf = ut_malloc_nokey(sizeof(srv_slot_t::debug_sync_t) + len); + srv_slot_t::debug_sync_t *sync = new(buf) srv_slot_t::debug_sync_t(); + strcpy(sync->str, value_str); + + rw_lock_x_lock(&slot->debug_sync_lock); + UT_LIST_ADD_LAST(slot->debug_sync, sync); + rw_lock_x_unlock(&slot->debug_sync_lock); +} +static +void +innobase_debug_sync_set(THD *thd, st_mysql_sys_var*, void *, const void *value) +{ + srv_for_each_thread(SRV_WORKER, innobase_debug_sync_callback, value); + srv_for_each_thread(SRV_PURGE, innobase_debug_sync_callback, value); +} +#endif + static SHOW_VAR innodb_status_variables_export[]= { {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, {NullS, NullS, SHOW_LONG} @@ -19881,7 +19908,8 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, NULL, NULL, 4, /* Default setting */ 1, /* Minimum value */ - 32, 0); /* Maximum value */ + srv_max_purge_threads,/* Maximum value */ + 0); static MYSQL_SYSVAR_ULONG(sync_array_size, srv_sync_array_size, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, @@ -20982,6 +21010,16 @@ static MYSQL_SYSVAR_BOOL(debug_force_scrubbing, 0, "Perform extra scrubbing to increase test exposure", NULL, NULL, FALSE); + +char *innobase_debug_sync; +static MYSQL_SYSVAR_STR(debug_sync, innobase_debug_sync, + PLUGIN_VAR_NOCMDARG, + "debug_sync for innodb purge threads. " + "Use it t oset up sync points for all purge threads " + "at once. The commands will be applied sequentially at " + "the beginning of purging the next node ", + NULL, + innobase_debug_sync_set, NULL); #endif /* UNIV_DEBUG */ static MYSQL_SYSVAR_BOOL(instrument_semaphores, innodb_instrument_semaphores, @@ -21204,6 +21242,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(background_scrub_data_check_interval), #ifdef UNIV_DEBUG MYSQL_SYSVAR(debug_force_scrubbing), + MYSQL_SYSVAR(debug_sync), #endif MYSQL_SYSVAR(instrument_semaphores), MYSQL_SYSVAR(buf_dump_status_frequency), diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index a740985082a..3e23978f54c 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -385,6 +385,9 @@ struct que_thr_t{ related delete/updates */ row_prebuilt_t* prebuilt; /*!< prebuilt structure processed by the query thread */ + + ut_d(srv_slot_t *thread_slot;) /*!< a slot from srv_sys.sys_threads + * if any */ }; #define QUE_THR_MAGIC_N 8476583 diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 0f1936eac70..dbed637aa0d 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -615,6 +615,8 @@ extern ulong srv_fatal_semaphore_wait_threshold; /** Buffer pool dump status frequence in percentages */ extern ulong srv_buf_dump_status_frequency; +constexpr uint srv_max_purge_threads = 32; + # ifdef UNIV_PFS_THREAD /* Keys to register InnoDB threads with performance schema */ extern mysql_pfs_key_t buf_dump_thread_key; @@ -1128,8 +1130,26 @@ struct srv_slot_t{ to do */ que_thr_t* thr; /*!< suspended query thread (only used for user threads) */ +#ifdef UNIV_DEBUG + struct debug_sync_t { + UT_LIST_NODE_T(debug_sync_t) + debug_sync_list; + char str[0]; + }; + UT_LIST_BASE_NODE_T(debug_sync_t) + debug_sync; + rw_lock_t debug_sync_lock; +#endif }; +#ifdef UNIV_DEBUG +typedef void srv_slot_callback_t(srv_slot_t*, const void*); + +void srv_for_each_thread(srv_thread_type type, + srv_slot_callback_t callback, + const void *arg); +#endif + #ifdef WITH_WSREP UNIV_INTERN void diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 3a5696cee1c..73d497dd64a 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -67,7 +67,12 @@ trx_purge( submit to task queue. */ ulint limit, /*!< in: the maximum number of records to purge in one batch */ - bool truncate); /*!< in: truncate history if true */ + bool truncate /*!< in: truncate history if true */ +#ifdef UNIV_DEBUG + , srv_slot_t *slot /*!< in/out: purge coordinator + thread slot */ +#endif +); /*******************************************************************//** Stop purge and wait for it to stop, move to PURGE_STATE_STOP. */ void diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 1d3d1573299..96f90d63759 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -1082,6 +1082,9 @@ que_run_threads_low( ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_ad(!trx_mutex_own(thr_get_trx(thr))); + /* slot can be received from purge thread for debug_sync setup */ + ut_d(srv_slot_t *slot = thr->thread_slot); + /* cumul_resource counts how much resources the OS thread (NOT the query thread) has spent in this function */ diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 560315af499..525f8e0c18e 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -46,6 +46,7 @@ Created 3/14/1997 Heikki Tuuri #include "handler.h" #include "ha_innodb.h" #include "fil0fil.h" +#include "debug_sync.h" /************************************************************************* IMPORTANT NOTE: Any operation that generates redo MUST check that there @@ -1209,6 +1210,25 @@ row_purge_step( node->start(); +#ifdef UNIV_DEBUG + srv_slot_t *slot = thr->thread_slot; + ut_ad(slot); + + rw_lock_x_lock(&slot->debug_sync_lock); + while (UT_LIST_GET_LEN(slot->debug_sync)) { + srv_slot_t::debug_sync_t *sync = + UT_LIST_GET_FIRST(slot->debug_sync); + bool result = debug_sync_set_action(current_thd, + sync->str, + strlen(sync->str)); + ut_a(!result); + + UT_LIST_REMOVE(slot->debug_sync, sync); + ut_free(sync); + } + rw_lock_x_unlock(&slot->debug_sync_lock); +#endif + if (!(node->undo_recs == NULL || ib_vector_is_empty(node->undo_recs))) { trx_purge_rec_t*purge_rec; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index bff26d05029..16efe4a6a34 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -619,7 +619,8 @@ struct srv_sys_t{ ulint n_sys_threads; /*!< size of the sys_threads array */ - srv_slot_t sys_threads[32 + 1]; /*!< server thread table; + srv_slot_t + sys_threads[srv_max_purge_threads + 1]; /*!< server thread table; os_event_set() and os_event_reset() on sys_threads[]->event are @@ -661,11 +662,15 @@ and/or load it during startup. */ char srv_buffer_pool_dump_at_shutdown = TRUE; char srv_buffer_pool_load_at_startup = TRUE; +/** Slot index in the srv_sys.sys_threads array for the master thread. */ +constexpr ulint SRV_MASTER_SLOT = 0; + /** Slot index in the srv_sys.sys_threads array for the purge thread. */ -static const ulint SRV_PURGE_SLOT = 1; +constexpr ulint SRV_PURGE_SLOT = 1; -/** Slot index in the srv_sys.sys_threads array for the master thread. */ -static const ulint SRV_MASTER_SLOT = 0; +/** Slot index in the srv_sys.sys_threads array from which purge workers start. + */ +constexpr ulint SRV_WORKER_SLOTS_START = 2; #ifdef HAVE_PSI_STAGE_INTERFACE /** Performance schema stage event for monitoring ALTER TABLE progress @@ -813,7 +818,7 @@ srv_reserve_slot( case SRV_WORKER: /* Find an empty slot, skip the master and purge slots. */ - for (slot = &srv_sys.sys_threads[2]; + for (slot = &srv_sys.sys_threads[SRV_WORKER_SLOTS_START]; slot->in_use; ++slot) { @@ -2530,10 +2535,11 @@ srv_purge_should_exit(ulint n_purged) /*********************************************************************//** Fetch and execute a task from the work queue. +@param [in,out] slot purge worker thread slot @return true if a task was executed */ static bool -srv_task_execute(void) +srv_task_execute(ut_d(srv_slot_t *slot)) /*==================*/ { que_thr_t* thr = NULL; @@ -2555,6 +2561,7 @@ srv_task_execute(void) mutex_exit(&srv_sys.tasks_mutex); if (thr != NULL) { + ut_d(thr->thread_slot = slot); que_run_threads(thr); @@ -2591,6 +2598,13 @@ DECLARE_THREAD(srv_worker_thread)( slot = srv_reserve_slot(SRV_WORKER); +#ifdef UNIV_DEBUG + UT_LIST_INIT(slot->debug_sync, + &srv_slot_t::debug_sync_t::debug_sync_list); + rw_lock_create(PFS_NOT_INSTRUMENTED, &slot->debug_sync_lock, + SYNC_NO_ORDER_CHECK); +#endif + ut_a(srv_n_purge_threads > 1); ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER])) < srv_n_purge_threads); @@ -2603,7 +2617,7 @@ DECLARE_THREAD(srv_worker_thread)( srv_suspend_thread(slot); srv_resume_thread(slot); - if (srv_task_execute()) { + if (srv_task_execute(ut_d(slot))) { /* If there are tasks in the queue, wakeup the purge coordinator thread. */ @@ -2640,10 +2654,15 @@ DECLARE_THREAD(srv_worker_thread)( /** Do the actual purge operation. @param[in,out] n_total_purged total number of purged pages +@param[in,out] slot purge coordinator thread slot @return length of history list before the last purge batch. */ static ulint -srv_do_purge(ulint* n_total_purged) +srv_do_purge(ulint* n_total_purged +#ifdef UNIV_DEBUG + , srv_slot_t *slot +#endif +) { ulint n_pages_purged; @@ -2709,7 +2728,11 @@ srv_do_purge(ulint* n_total_purged) n_pages_purged = trx_purge( n_use_threads, srv_purge_batch_size, - (++count % rseg_truncate_frequency) == 0); + (++count % rseg_truncate_frequency) == 0 +#ifdef UNIV_DEBUG + , slot +#endif + ); *n_total_purged += n_pages_purged; } while (!srv_purge_should_exit(n_pages_purged) @@ -2829,6 +2852,12 @@ DECLARE_THREAD(srv_purge_coordinator_thread)( slot = srv_reserve_slot(SRV_PURGE); +#ifdef UNIV_DEBUG + UT_LIST_INIT(slot->debug_sync, + &srv_slot_t::debug_sync_t::debug_sync_list); + rw_lock_create(PFS_NOT_INSTRUMENTED, &slot->debug_sync_lock, + SYNC_NO_ORDER_CHECK); +#endif ulint rseg_history_len = trx_sys->rseg_history_len; do { @@ -2851,7 +2880,11 @@ DECLARE_THREAD(srv_purge_coordinator_thread)( n_total_purged = 0; - rseg_history_len = srv_do_purge(&n_total_purged); + rseg_history_len = srv_do_purge(&n_total_purged +#ifdef UNIV_DEBUG + , slot +#endif + ); } while (!srv_purge_should_exit(n_total_purged)); /* The task queue should always be empty, independent of fast @@ -3012,3 +3045,35 @@ srv_was_tablespace_truncated(const fil_space_t* space) return (!is_system_tablespace(space->id) && truncate_t::was_tablespace_truncated(space->id)); } + +#ifdef UNIV_DEBUG +static uint get_first_slot(srv_thread_type type) +{ + switch (type) { + case SRV_MASTER: + return SRV_MASTER_SLOT; + case SRV_PURGE: + return SRV_PURGE_SLOT; + case SRV_WORKER: + /* Find an empty slot, skip the master and purge slots. */ + return SRV_WORKER_SLOTS_START; + default: + ut_error; + } +} + +void srv_for_each_thread(srv_thread_type type, + srv_slot_callback_t callback, + const void *arg) +{ + int slot_idx= get_first_slot(type); + while(slot_idx < srv_sys.n_sys_threads + && srv_sys.sys_threads[slot_idx].in_use + && srv_sys.sys_threads[slot_idx].type == type) + { + srv_slot_t *slot= &srv_sys.sys_threads[slot_idx]; + callback(slot, arg); + slot_idx++; + } +} +#endif diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 78bf2fc29b8..732435ccefb 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1675,7 +1675,12 @@ trx_purge( to submit to the work queue */ ulint batch_size, /*!< in: the maximum number of records to purge in one batch */ - bool truncate) /*!< in: truncate history if true */ + bool truncate /*!< in: truncate history if true */ +#ifdef UNIV_DEBUG + , srv_slot_t *slot /*!< in/out: purge coordinator + thread slot */ +#endif +) { que_thr_t* thr = NULL; ulint n_pages_handled; @@ -1730,6 +1735,7 @@ trx_purge( run_synchronously: ++purge_sys->n_submitted; + ut_d(thr->thread_slot = slot); que_run_threads(thr); my_atomic_addlint( -- cgit v1.2.1 From 350e46a8b52b20c7ddd311ca56f12ab77ffae0ae Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Tue, 30 Jul 2019 22:39:55 +1000 Subject: MDEV-18546 ASAN heap-use-after-free in innobase_get_computed_value / row_purge the bug was already fixed in MDEV-17005, so now only test is added --- .../suite/gcol/r/innodb_virtual_debug_purge.result | 45 +++++++++++++++ .../suite/gcol/t/innodb_virtual_debug_purge.test | 64 ++++++++++++++++++++++ storage/innobase/row/row0vers.cc | 1 + 3 files changed, 110 insertions(+) diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result index 647ba47a880..0309f084e5d 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -233,3 +233,48 @@ set global debug_dbug= @saved_dbug; drop table t1; set debug_sync=reset; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; +# +# MDEV-18546 ASAN heap-use-after-free +# in innobase_get_computed_value / row_purge +# +CREATE TABLE t1 ( +pk INT AUTO_INCREMENT, +b BIT(15), +v BIT(15) AS (b) VIRTUAL, +PRIMARY KEY(pk), +UNIQUE(v) +) ENGINE=InnoDB; +INSERT IGNORE INTO t1 (b) VALUES +(NULL),(b'011'),(b'000110100'), +(b'01101101010'),(b'01111001001011'),(NULL); +SET GLOBAL innodb_debug_sync = "ib_clust_v_col_before_row_allocated " + "SIGNAL before_row_allocated " + "WAIT_FOR flush_unlock"; +SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open " + "SIGNAL purge_open " + "WAIT_FOR select_open"; +set @saved_dbug= @@global.debug_dbug; +set global debug_dbug= "+d,ib_purge_virtual_index_callback"; +connect purge_waiter,localhost,root; +SET debug_sync= "now WAIT_FOR before_row_allocated"; +connection default; +REPLACE INTO t1 (pk, b) SELECT pk, b FROM t1; +connection purge_waiter; +connection default; +disconnect purge_waiter; +FLUSH TABLES; +SET GLOBAL innodb_debug_sync = reset; +SET debug_sync= "now SIGNAL flush_unlock WAIT_FOR purge_open"; +SET GLOBAL innodb_debug_sync = reset; +SET debug_sync= "ib_open_after_dict_open SIGNAL select_open"; +SELECT * FROM t1; +pk b v +1 NULL NULL +2   +3 4 4 +4 j j +5 K K +6 NULL NULL +DROP TABLE t1; +SET debug_sync= reset; +set global debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index ee88789dec4..4ea3c9fd34b 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -323,3 +323,67 @@ drop table t1; --source include/wait_until_count_sessions.inc set debug_sync=reset; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; + +--echo # +--echo # MDEV-18546 ASAN heap-use-after-free +--echo # in innobase_get_computed_value / row_purge +--echo # + +CREATE TABLE t1 ( + pk INT AUTO_INCREMENT, + b BIT(15), + v BIT(15) AS (b) VIRTUAL, + PRIMARY KEY(pk), + UNIQUE(v) +) ENGINE=InnoDB; +INSERT IGNORE INTO t1 (b) VALUES + (NULL),(b'011'),(b'000110100'), + (b'01101101010'),(b'01111001001011'),(NULL); + +SET GLOBAL innodb_debug_sync = "ib_clust_v_col_before_row_allocated " + "SIGNAL before_row_allocated " + "WAIT_FOR flush_unlock"; +SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open " + "SIGNAL purge_open " + "WAIT_FOR select_open"; + +# In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge, +# so this condition is forced to pass in row_vers_old_has_index_entry +set @saved_dbug= @@global.debug_dbug; +set global debug_dbug= "+d,ib_purge_virtual_index_callback"; + +# The purge starts from REPLACE command. To avoid possible race, separate +# connection is used. +--connect(purge_waiter,localhost,root) +--send +SET debug_sync= "now WAIT_FOR before_row_allocated"; + +--connection default +REPLACE INTO t1 (pk, b) SELECT pk, b FROM t1; + +--connection purge_waiter +# Now we will definitely catch ib_clust_v_col_before_row_allocated +--reap +--connection default +--disconnect purge_waiter + +# purge hangs on the sync point. table is purged, ref_count is set to 0 +FLUSH TABLES; + +# Avoid hang on repeating purge. +# Reset Will be applied after first record is purged +SET GLOBAL innodb_debug_sync = reset; + +SET debug_sync= "now SIGNAL flush_unlock WAIT_FOR purge_open"; + +# Avoid hang on repeating purge +SET GLOBAL innodb_debug_sync = reset; + +# select unblocks purge thread +SET debug_sync= "ib_open_after_dict_open SIGNAL select_open"; +SELECT * FROM t1; + +# Cleanup +DROP TABLE t1; +SET debug_sync= reset; +set global debug_dbug= @saved_dbug; \ No newline at end of file diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index 03e586d4bee..f2a574b8331 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -467,6 +467,7 @@ row_vers_build_clust_v_col( vcol_info->set_used(); maria_table = vcol_info->table(); } + DEBUG_SYNC(current_thd, "ib_clust_v_col_before_row_allocated"); innobase_allocate_row_for_vcol(thd, index, &local_heap, -- cgit v1.2.1 From 5ef122443451506aa5d5c432d80d808289282709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 12:29:12 +0300 Subject: MDEV-20804 Speed up main.index_merge_innodb The test main.index_merge_innodb is taking very much time, especially on later versions (10.2 and 10.3). Some of this could be attributed to the use of INSERT...SELECT, which is time-consumingly creating explicit record locks in InnoDB for the locking read in the SELECT part. In 10.3 and later, some slowness can be attributed to MDEV-12288, which makes the InnoDB purge thread spend time to reset transaction identifiers in the inserted records. If we prevent purge from running before all tables are dropped, the test seems to be 10% faster on an unoptimized debug build on 10.5. (A proper fix would be to implement MDEV-515 and stop writing row-level undo log records for inserts into an empty table or partition.) At the same time, it should not hurt to make main.index_merge_myisam to use the sequence engine. Not only could it be a little faster, but the test would be slightly more readable. --- mysql-test/include/index_merge1.inc | 52 +++++--------------- mysql-test/include/index_merge2.inc | 48 ++----------------- mysql-test/include/index_merge_2sweeps.inc | 24 ++-------- mysql-test/include/index_merge_ror.inc | 5 -- mysql-test/include/index_merge_ror_cpk.inc | 12 +---- mysql-test/r/index_merge_innodb.result | 72 +++++++++------------------- mysql-test/r/index_merge_myisam.result | 76 ++++++------------------------ mysql-test/t/index_merge_innodb.test | 52 +++++++++----------- mysql-test/t/index_merge_myisam.test | 14 ++---- 9 files changed, 83 insertions(+), 272 deletions(-) diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index 7880091ac10..7e656eb38af 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -2,11 +2,10 @@ # # Index merge tests # -# The variables -# $engine_type -- storage engine to be tested +# The variable # $merge_table_support -- 1 storage engine supports merge tables # -- 0 storage engine does not support merge tables -# have to be set before sourcing this script. +# has to be set before sourcing this script. # # Note: The comments/expectations refer to MyISAM. # They might be not valid for other storage engines. @@ -16,15 +15,10 @@ # old name was t/index_merge.test # main code went into include/index_merge1.inc # +--source include/have_sequence.inc --echo #---------------- Index merge test 1 ------------------------------------------- -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t0, t1, t2, t3, t4; ---enable_warnings - # Create and fill a table with simple keys create table t0 ( @@ -32,20 +26,7 @@ create table t0 INDEX i1(key1) ); ---disable_query_log -insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); - -let $1=7; -set @d=8; -begin; -while ($1) -{ - eval insert into t0 select key1+@d from t0; - eval set @d=@d*2; - dec $1; -} -commit; ---enable_query_log +insert into t0(key1) select seq from seq_1_to_1024; alter table t0 add key2 int not null, add index i2(key2); alter table t0 add key3 int not null, add index i3(key3); @@ -215,7 +196,7 @@ create table t4 ( index i2_2(key2, key2_1) ); -insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0; +insert into t4 select seq,seq,seq div 10, seq % 10, seq % 10, seq from seq_1_to_1024; # the following will be handled by index_merge: select * from t4 where key1a = 3 or key1b = 4; @@ -390,14 +371,13 @@ if ($merge_table_support) # # BUG#17314: Index_merge/intersection not choosen by the optimizer for MERGE tables # -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 ( a int, b int, filler1 char(200), filler2 char(200), key(a),key(b) ); -insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C; +insert into t1 select @v:= seq % 10, @v, 't1', 'filler2' from seq_1_to_1000; + create table t2 like t1; create table t3 ( @@ -411,8 +391,7 @@ explain select * from t1 where a=1 and b=1; --replace_column 9 # explain select * from t3 where a=1 and b=1; -drop table t3; -drop table t0, t1, t2; +drop table t1, t2, t3; } # @@ -511,16 +490,13 @@ DROP TABLE t1; --echo # --echo # BUG#40974: Incorrect query results when using clause evaluated using range check --echo # -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); - create table t1 (a int); insert into t1 values (1),(2); create table t2(a int, b int); insert into t2 values (1,1), (2, 1000); create table t3 (a int, b int, filler char(100), key(a), key(b)); -insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 select 1000, 1000,'filler' from seq_1_to_1000; insert into t3 values (1,1,'data'); insert into t3 values (1,1,'data'); -- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) @@ -532,20 +508,14 @@ select * from t1 where exists (select 1 from t2, t3 where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); -drop table t0, t1, t2, t3; +drop table t1, t2, t3; --echo # --echo # BUG#44810: index merge and order by with low sort_buffer_size --echo # crashes server! --echo # CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B)); -INSERT INTO t1 VALUES (REPEAT('a',128),REPEAT('b',128)); -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT REPEAT('a',128),REPEAT('b',128) FROM seq_1_to_64; SET SESSION sort_buffer_size=1024*8; EXPLAIN SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index ae9adac882f..ecb16f54bbc 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -2,10 +2,6 @@ # # Index merge tests # -# The variable -# $engine_type -- storage engine to be tested -# has to be set before sourcing this script. -# # Note: The comments/expectations refer to InnoDB. # They might be not valid for other storage engines. # @@ -14,15 +10,10 @@ # old name was t/index_merge_innodb.test # main code went into include/index_merge2.inc # +--source include/have_sequence.inc --echo #---------------- Index merge test 2 ------------------------------------------- -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - create table t1 ( key1 int not null, @@ -32,16 +23,7 @@ create table t1 INDEX i2(key2) ); ---disable_query_log -let $1=200; -begin; -while ($1) -{ - eval insert into t1 values (200-$1, $1); - dec $1; -} -commit; ---enable_query_log +INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200; # No primary key explain select * from t1 where key1 < 5 or key2 > 197; @@ -80,16 +62,8 @@ create table t1 ( index (key2) ); show warnings; ---disable_query_log -let $1=30; -begin; -while ($1) -{ - eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data'); - dec $1; -} -commit; ---enable_query_log +INSERT INTO t1 (key1, key2, filler) +SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0; explain select pk from t1 where key1 = 1 and key2 = 1; select pk from t1 where key2 = 1 and key1 = 1; select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1; @@ -331,19 +305,7 @@ create table t1 key3 int not null default 0 ); -insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); - -let $1=7; -set @d=8; -begin; -while ($1) -{ - eval insert into t1 (key1) select key1+@d from t1; - eval set @d=@d*2; - dec $1; -} -commit; - +insert into t1(key1) select seq from seq_1_to_1024; alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; diff --git a/mysql-test/include/index_merge_2sweeps.inc b/mysql-test/include/index_merge_2sweeps.inc index ef356e12969..836f83795a9 100644 --- a/mysql-test/include/index_merge_2sweeps.inc +++ b/mysql-test/include/index_merge_2sweeps.inc @@ -2,24 +2,15 @@ # # 2-sweeps read Index_merge test # -# The variable -# $engine_type -- storage engine to be tested -# has to be set before sourcing this script. -# # Last update: # 2006-08-02 ML test refactored # old name was index_merge_innodb2.test # main code went into include/index_merge_2sweeps.inc # +--source include/have_sequence.inc --echo #---------------- 2-sweeps read Index merge test 2 ------------------------------- -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t1; ---enable_warnings - create table t1 ( pk int primary key, key1 int, @@ -30,17 +21,8 @@ create table t1 ( index(key2) ); - ---disable_query_log -begin; -let $1=1000; -while ($1) -{ - eval insert into t1 values($1, $1, $1, 'filler-data','filler-data-2'); - dec $1; -} -commit; ---enable_query_log +insert into t1 select seq, seq, seq, 'filler-data', 'filler-data-2' +from seq_1000_to_1; select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); diff --git a/mysql-test/include/index_merge_ror.inc b/mysql-test/include/index_merge_ror.inc index 3ec6e342994..8a55ef1a67d 100644 --- a/mysql-test/include/index_merge_ror.inc +++ b/mysql-test/include/index_merge_ror.inc @@ -17,11 +17,6 @@ --echo #---------------- ROR-index_merge tests ----------------------- -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t0,t1,t2; ---enable_warnings create table t1 ( /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */ diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index 0a307aa4fdb..9ebca3cd22f 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -2,10 +2,6 @@ # # Clustered PK ROR-index_merge tests # -# The variable -# $engine_type -- storage engine to be tested -# has to be set before sourcing this script. -# # Note: The comments/expectations refer to InnoDB. # They might be not valid for other storage engines. # @@ -15,13 +11,9 @@ # main code went into include/index_merge_ror_cpk.inc # ---echo #---------------- Clustered PK ROR-index_merge tests ----------------------------- - -eval SET SESSION STORAGE_ENGINE = $engine_type; +--source include/have_sequence.inc ---disable_warnings -drop table if exists t1; ---enable_warnings +--echo #---------------- Clustered PK ROR-index_merge tests ----------------------------- create table t1 ( diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 7e2a13128bb..0a80fa4171c 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -1,8 +1,9 @@ +# Disable the purge of InnoDB history, to make the test run faster. +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SET STORAGE_ENGINE = InnoDB; set @optimizer_switch_save= @@optimizer_switch; set optimizer_switch='index_merge_sort_intersection=off'; #---------------- Index merge test 2 ------------------------------------------- -SET SESSION STORAGE_ENGINE = InnoDB; -drop table if exists t1,t2; create table t1 ( key1 int not null, @@ -10,6 +11,7 @@ key2 int not null, INDEX i1(key1), INDEX i2(key2) ); +INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200; explain select * from t1 where key1 < 5 or key2 > 197; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where @@ -67,6 +69,8 @@ index (key2) ); show warnings; Level Code Message +INSERT INTO t1 (key1, key2, filler) +SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0; explain select pk from t1 where key1 = 1 and key2 = 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index @@ -292,24 +296,7 @@ key1 int not null, key2 int not null default 0, key3 int not null default 0 ); -insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); -set @d=8; -begin; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -commit; +insert into t1(key1) select seq from seq_1_to_1024; alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; @@ -388,8 +375,6 @@ a b 1 b DROP TABLE t1, t2; #---------------- 2-sweeps read Index merge test 2 ------------------------------- -SET SESSION STORAGE_ENGINE = InnoDB; -drop table if exists t1; create table t1 ( pk int primary key, key1 int, @@ -399,6 +384,8 @@ filler2 char(200), index(key1), index(key2) ); +insert into t1 select seq, seq, seq, 'filler-data', 'filler-data-2' +from seq_1000_to_1; select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); pk key1 key2 filler filler2 2 2 2 filler-data filler-data-2 @@ -526,8 +513,6 @@ pk key1 key2 filler filler2 54 54 54 filler-data filler-data-2 drop table t1; #---------------- Clustered PK ROR-index_merge tests ----------------------------- -SET SESSION STORAGE_ENGINE = InnoDB; -drop table if exists t1; create table t1 ( pk1 int not null, @@ -668,34 +653,27 @@ DROP TABLE t1,t2; # # BUG#56862/640419: Wrong result with sort_union index merge when one # of the merged index scans is the primary key scan -# +# +CREATE TABLE t0(a int, b int) ENGINE=MyISAM; CREATE TABLE t1 ( pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, a int, b int, INDEX idx(a)) ENGINE=INNODB; -begin; -INSERT INTO t1(a,b) VALUES +INSERT INTO t0(a,b) VALUES (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); -INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; -INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; -INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t0(a,b) SELECT a+20, b+2000 FROM t0; +INSERT INTO t0(a,b) SELECT a+40, b+4000 FROM t0; +INSERT INTO t0(a,b) SELECT a+80, b+8000 FROM t0; +begin; +INSERT INTO t1(a,b) SELECT t0.a,t0.b FROM t0, seq_1_to_1024; INSERT INTO t1 VALUES (1000000, 0, 0); commit; +DROP TABLE t0; SET SESSION sort_buffer_size = 1024*36; set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; @@ -759,8 +737,6 @@ DROP TABLE t1; # # BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows # -create table t0(a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 ( pk int auto_increment, zone_id int, @@ -769,7 +745,7 @@ primary key(pk), key (zone_id), key (modified) ) engine=innodb; -insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D; +insert into t1 (zone_id, modified) select 0,0 from seq_1_to_10000; update t1 set zone_id=487, modified=9 where pk=7259; update t1 set zone_id=487, modified=9 where pk=7260; update t1 set zone_id=830, modified=9 where pk=8434; @@ -787,7 +763,7 @@ DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9; commit; select * from t1 where t1.zone_id=830 AND modified=9; pk zone_id modified -drop table t0, t1; +drop table t1; # # MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join # @@ -822,14 +798,10 @@ PRIMARY KEY (pk), KEY key1 (key1), KEY key2 (key2) ) ENGINE=InnoDB AUTO_INCREMENT=12860259 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; -create table t2(a int); -insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -create table t3(a int); -insert into t3 select A.a + B.a* 10 + C.a * 100 + D.a*1000 from t2 A, t2 B, t2 C, t2 D; insert into t1 (key1, key2, col1,col2,col3,col4) -select a,a, a,a,a,a from t3; +select seq,seq,seq,seq,seq,seq from seq_1_to_10000; SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 8191+10) or (key2= 5); sum(col1) 33632261 -drop table t1,t2,t3; +drop table t1; set optimizer_switch=@tmp_optimizer_switch; diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index c0823d41b14..b87a7dfef4b 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1,13 +1,13 @@ +SET STORAGE_ENGINE = MyISAM; set @optimizer_switch_save= @@optimizer_switch; set optimizer_switch='index_merge_sort_intersection=off'; #---------------- Index merge test 1 ------------------------------------------- -SET SESSION STORAGE_ENGINE = MyISAM; -drop table if exists t0, t1, t2, t3, t4; create table t0 ( key1 int not null, INDEX i1(key1) ); +insert into t0(key1) select seq from seq_1_to_1024; alter table t0 add key2 int not null, add index i2(key2); alter table t0 add key3 int not null, add index i3(key3); alter table t0 add key4 int not null, add index i4(key4); @@ -225,7 +225,7 @@ index i2_2(key2, key2_1) ); Warnings: Note 1831 Duplicate index `i2_2`. This is deprecated and will be disallowed in a future release. -insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0; +insert into t4 select seq,seq,seq div 10, seq % 10, seq % 10, seq from seq_1_to_1024; select * from t4 where key1a = 3 or key1b = 4; key1a key1b key2 key2_1 key2_2 key3 3 3 0 3 3 3 @@ -411,14 +411,12 @@ explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'b id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where drop table t1; -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 ( a int, b int, filler1 char(200), filler2 char(200), key(a),key(b) ); -insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C; +insert into t1 select @v:= seq % 10, @v, 't1', 'filler2' from seq_1_to_1000; create table t2 like t1; create table t3 ( a int, b int, @@ -431,8 +429,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t3 where a=1 and b=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where -drop table t3; -drop table t0, t1, t2; +drop table t1, t2, t3; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b)); @@ -537,14 +534,12 @@ DROP TABLE t1; # # BUG#40974: Incorrect query results when using clause evaluated using range check # -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 (a int); insert into t1 values (1),(2); create table t2(a int, b int); insert into t2 values (1,1), (2, 1000); create table t3 (a int, b int, filler char(100), key(a), key(b)); -insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 select 1000, 1000,'filler' from seq_1_to_1000; insert into t3 values (1,1,'data'); insert into t3 values (1,1,'data'); The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) @@ -561,19 +556,13 @@ where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); a 1 2 -drop table t0, t1, t2, t3; +drop table t1, t2, t3; # # BUG#44810: index merge and order by with low sort_buffer_size # crashes server! # CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B)); -INSERT INTO t1 VALUES (REPEAT('a',128),REPEAT('b',128)); -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT REPEAT('a',128),REPEAT('b',128) FROM seq_1_to_64; SET SESSION sort_buffer_size=1024*8; EXPLAIN SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' @@ -586,8 +575,6 @@ SET SESSION sort_buffer_size=DEFAULT; DROP TABLE t1; End of 5.0 tests #---------------- ROR-index_merge tests ----------------------- -SET SESSION STORAGE_ENGINE = MyISAM; -drop table if exists t0,t1,t2; create table t1 ( /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */ @@ -836,8 +823,6 @@ SELECT * FROM t1; c1 c2 c3 DROP TABLE t1,t2; #---------------- Index merge test 2 ------------------------------------------- -SET SESSION STORAGE_ENGINE = MyISAM; -drop table if exists t1,t2; create table t1 ( key1 int not null, @@ -845,6 +830,7 @@ key2 int not null, INDEX i1(key1), INDEX i2(key2) ); +INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200; explain select * from t1 where key1 < 5 or key2 > 197; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where @@ -902,6 +888,8 @@ index (key2) ); show warnings; Level Code Message +INSERT INTO t1 (key1, key2, filler) +SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0; explain select pk from t1 where key1 = 1 and key2 = 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1,key2 key1 5 const 4 Using where @@ -1127,24 +1115,7 @@ key1 int not null, key2 int not null default 0, key3 int not null default 0 ); -insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); -set @d=8; -begin; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -commit; +insert into t1(key1) select seq from seq_1_to_1024; alter table t1 add index i2(key2); alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; @@ -1223,8 +1194,6 @@ a b 1 b DROP TABLE t1, t2; #---------------- 2-sweeps read Index merge test 2 ------------------------------- -SET SESSION STORAGE_ENGINE = MyISAM; -drop table if exists t1; create table t1 ( pk int primary key, key1 int, @@ -1234,6 +1203,8 @@ filler2 char(200), index(key1), index(key2) ); +insert into t1 select seq, seq, seq, 'filler-data', 'filler-data-2' +from seq_1000_to_1; select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); pk key1 key2 filler filler2 10 10 10 filler-data filler-data-2 @@ -1361,8 +1332,6 @@ pk key1 key2 filler filler2 1 1 1 filler-data filler-data-2 drop table t1; #---------------- Clustered PK ROR-index_merge tests ----------------------------- -SET SESSION STORAGE_ENGINE = MyISAM; -drop table if exists t1; create table t1 ( pk1 int not null, @@ -1723,22 +1692,7 @@ create table t0 key1 int not null, INDEX i1(key1) ); -insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); -set @d=8; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; -insert into t0 select key1+ @d from t0; -set @d=@d*2; +insert into t0 select * from seq_1_to_1024; alter table t0 add key2 int not null, add index i2(key2); alter table t0 add key3 int not null, add index i3(key3); alter table t0 add key8 int not null, add index i8(key8); diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index b7b2e60f20b..31ca1c253e4 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -14,7 +14,12 @@ --source include/not_staging.inc --source include/have_xtradb.inc -let $engine_type= InnoDB; +connect disable_purge,localhost,root,,; +--echo # Disable the purge of InnoDB history, to make the test run faster. +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; + +SET STORAGE_ENGINE = InnoDB; # InnoDB does not support Merge tables (affects include/index_merge1.inc) let $merge_table_support= 0; @@ -37,7 +42,9 @@ set optimizer_switch='index_merge_sort_intersection=off'; --echo # --echo # BUG#56862/640419: Wrong result with sort_union index merge when one --echo # of the merged index scans is the primary key scan ---echo # +--echo # + +CREATE TABLE t0(a int, b int) ENGINE=MyISAM; CREATE TABLE t1 ( pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -46,27 +53,19 @@ CREATE TABLE t1 ( INDEX idx(a)) ENGINE=INNODB; -begin; -INSERT INTO t1(a,b) VALUES +INSERT INTO t0(a,b) VALUES (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); -INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; -INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; -INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; -INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t0(a,b) SELECT a+20, b+2000 FROM t0; +INSERT INTO t0(a,b) SELECT a+40, b+4000 FROM t0; +INSERT INTO t0(a,b) SELECT a+80, b+8000 FROM t0; +begin; +INSERT INTO t1(a,b) SELECT t0.a,t0.b FROM t0, seq_1_to_1024; INSERT INTO t1 VALUES (1000000, 0, 0); commit; +DROP TABLE t0; SET SESSION sort_buffer_size = 1024*36; set @tmp_optimizer_switch=@@optimizer_switch; @@ -130,9 +129,6 @@ DROP TABLE t1; --echo # BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows --echo # -create table t0(a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); - create table t1 ( pk int auto_increment, zone_id int, @@ -142,7 +138,7 @@ create table t1 ( key (modified) ) engine=innodb; -insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D; +insert into t1 (zone_id, modified) select 0,0 from seq_1_to_10000; update t1 set zone_id=487, modified=9 where pk=7259; update t1 set zone_id=487, modified=9 where pk=7260; update t1 set zone_id=830, modified=9 where pk=8434; @@ -156,7 +152,7 @@ DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9; commit; select * from t1 where t1.zone_id=830 AND modified=9; -drop table t0, t1; +drop table t1; --echo # --echo # MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join @@ -196,14 +192,10 @@ KEY key1 (key1), KEY key2 (key2) ) ENGINE=InnoDB AUTO_INCREMENT=12860259 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; -create table t2(a int); -insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); - -create table t3(a int); -insert into t3 select A.a + B.a* 10 + C.a * 100 + D.a*1000 from t2 A, t2 B, t2 C, t2 D; - insert into t1 (key1, key2, col1,col2,col3,col4) -select a,a, a,a,a,a from t3; +select seq,seq,seq,seq,seq,seq from seq_1_to_10000; SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 8191+10) or (key2= 5); -drop table t1,t2,t3; +drop table t1; set optimizer_switch=@tmp_optimizer_switch; + +disconnect disable_purge; diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test index 75beb9bd883..2cee768706b 100644 --- a/mysql-test/t/index_merge_myisam.test +++ b/mysql-test/t/index_merge_myisam.test @@ -10,7 +10,7 @@ # include/index_merge*.inc files # -let $engine_type= MyISAM; +SET STORAGE_ENGINE = MyISAM; # MyISAM supports Merge tables let $merge_table_support= 1; @@ -33,7 +33,7 @@ insert into t1 select A.a * B.a*10 + C.a*100, A.a, 'filler' -from t0 A, t0 B, t0 C; +from t0 A, t0 B, t0 C; --echo This should use union: explain select * from t1 where a=1 or b=1; @@ -253,15 +253,7 @@ create table t0 INDEX i1(key1) ); -insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); -let $1=7; -set @d=8; -while ($1) -{ - eval insert into t0 select key1+ @d from t0; - eval set @d=@d*2; - dec $1; -} +insert into t0 select * from seq_1_to_1024; alter table t0 add key2 int not null, add index i2(key2); alter table t0 add key3 int not null, add index i3(key3); alter table t0 add key8 int not null, add index i8(key8); -- cgit v1.2.1 From 4ebaf8136096a5bd383971f93f6bb0b0df83cd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 14:02:35 +0300 Subject: MDEV-19455: Avoid SET DEBUG_DBUG='-d,...' construct Apply the correct pattern for debug instrumentation: SET @save_dbug=@@debug_dbug; SET debug_dbug='+d,...'; ... SET debug_dbug=@save_dbug; Numerous tests use statements of the form SET debug_dbug='-d,...'; which will inadvertently enable all DBUG tracing output, causing unnecessary waste of resources. --- mysql-test/r/drop_bad_db_type.result | 3 +- mysql-test/r/drop_debug.result | 5 +- mysql-test/r/partition_debug_sync.result | 7 +- mysql-test/r/sp-code.result | 3 +- .../suite/innodb/r/innodb_bug11754376.result | 3 +- mysql-test/suite/innodb/t/innodb_bug11754376.test | 3 +- mysql-test/suite/innodb/t/innodb_bug14147491.test | 3 +- mysql-test/suite/parts/inc/partition_crash_add.inc | 21 ++-- .../suite/parts/inc/partition_crash_change.inc | 25 ++-- .../suite/parts/inc/partition_crash_drop.inc | 19 +-- mysql-test/suite/parts/inc/partition_fail_add.inc | 21 ++-- .../suite/parts/inc/partition_fail_change.inc | 25 ++-- mysql-test/suite/parts/inc/partition_fail_drop.inc | 19 +-- .../suite/parts/r/partition_debug_innodb.result | 134 +++++++++++---------- .../suite/parts/r/partition_debug_myisam.result | 131 ++++++++++---------- .../suite/parts/t/partition_debug_innodb.test | 7 +- .../suite/parts/t/partition_debug_myisam.test | 4 - mysql-test/t/drop_bad_db_type.test | 4 +- mysql-test/t/drop_debug.test | 8 +- mysql-test/t/partition_debug_sync.test | 9 +- mysql-test/t/sp-code.test | 3 +- 21 files changed, 233 insertions(+), 224 deletions(-) diff --git a/mysql-test/r/drop_bad_db_type.result b/mysql-test/r/drop_bad_db_type.result index 6a125cdccf5..dad769a93bb 100644 --- a/mysql-test/r/drop_bad_db_type.result +++ b/mysql-test/r/drop_bad_db_type.result @@ -1,3 +1,4 @@ +SET @save_dbug = @@debug_dbug; set debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; @@ -9,4 +10,4 @@ t1.ARZ t1.frm drop table t1; uninstall soname 'ha_archive'; -set debug_dbug='-d,unstable_db_type'; +set debug_dbug=@save_dbug; diff --git a/mysql-test/r/drop_debug.result b/mysql-test/r/drop_debug.result index 852b3ac2163..21b5b2ea7cd 100644 --- a/mysql-test/r/drop_debug.result +++ b/mysql-test/r/drop_debug.result @@ -3,13 +3,12 @@ # -- Bug#43138: DROP DATABASE failure does not clean up message list. # -- -DROP DATABASE IF EXISTS mysql_test; - CREATE DATABASE mysql_test; CREATE TABLE mysql_test.t1(a INT); CREATE TABLE mysql_test.t2(b INT); CREATE TABLE mysql_test.t3(c INT); +SET @save_dbug = @@debug_dbug; SET SESSION debug_dbug= "+d,bug43138"; DROP DATABASE mysql_test; @@ -18,7 +17,7 @@ Error 1051 Unknown table 't1' Error 1051 Unknown table 't2' Error 1051 Unknown table 't3' -SET SESSION debug_dbug= "-d,bug43138"; +SET SESSION debug_dbug=@save_dbug; # -- # -- End of Bug#43138. diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result index ad0f6df5ff2..cb91e3b628d 100644 --- a/mysql-test/r/partition_debug_sync.result +++ b/mysql-test/r/partition_debug_sync.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1, t2; SET DEBUG_SYNC= 'RESET'; # # Bug#42438: Crash ha_partition::change_table_ptr @@ -18,6 +17,7 @@ ENGINE = MYISAM PARTITION p1 VALUES LESS THAN (20), PARTITION p2 VALUES LESS THAN (100), PARTITION p3 VALUES LESS THAN MAXVALUE ) */; +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug= "+d,sleep_before_create_table_no_lock"; SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter'; SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed'; @@ -28,7 +28,7 @@ SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter'; SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed'; DROP TABLE IF EXISTS t1; # Con 1 -SET SESSION debug_dbug= "-d,sleep_before_create_table_no_lock"; +SET SESSION debug_dbug=@save_dbug; SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET'; # @@ -51,12 +51,13 @@ SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_ SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done'; ALTER TABLE t2 REMOVE PARTITIONING; # Con default +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug= "+d,sleep_before_no_locks_delete_table"; SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions'; SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter'; SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done'; DROP TABLE IF EXISTS t2; -SET SESSION debug_dbug= "-d,sleep_before_no_locks_delete_table"; +SET SESSION debug_dbug=@save_dbug; # Con 1 ERROR 42S02: Table 'test.t2' doesn't exist SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index 67651294498..444b24626a7 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -923,6 +923,7 @@ END; CLOSE c; SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack END| +SET @save_dbug = @@debug_dbug; SET SESSION debug_dbug="+d,bug23032_emit_warning"; CALL p1(); Warning found! @@ -942,7 +943,7 @@ End of Result Set found! Level Code Message Warning 1105 Unknown error Error 1329 No data - zero rows fetched, selected, or processed -SET SESSION debug_dbug="-d,bug23032_emit_warning"; +SET SESSION debug_dbug=@save_dbug; DROP PROCEDURE p1; DROP TABLE t1; # diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result index 034e4f07403..34f045a8039 100644 --- a/mysql-test/suite/innodb/r/innodb_bug11754376.result +++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result @@ -1,4 +1,5 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; +SET @save_dbug=@@debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; -SET SESSION DEBUG_DBUG='-d,test_normalize_table_name_low'; +SET SESSION DEBUG_DBUG=@save_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug11754376.test b/mysql-test/suite/innodb/t/innodb_bug11754376.test index b740b7e08fe..43a96f152d5 100644 --- a/mysql-test/suite/innodb/t/innodb_bug11754376.test +++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test @@ -9,8 +9,9 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; # This will invoke test_normalize_table_name_low() in debug builds +SET @save_dbug=@@debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; -SET SESSION DEBUG_DBUG='-d,test_normalize_table_name_low'; +SET SESSION DEBUG_DBUG=@save_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test index 6f0bfca8e1d..98bbe4fc010 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14147491.test +++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test @@ -107,8 +107,7 @@ SLEEP 1; --enable_reconnect --source include/wait_until_connected_again.inc -# Note SET DEBUG = '-d,innodb_page_corruption_retries' is not required -# because the session information is lost after server restart +# Note: SET DEBUG_DBUG need not be reset, because the server was restarted --echo # Cleanup DROP TABLE t1; diff --git a/mysql-test/suite/parts/inc/partition_crash_add.inc b/mysql-test/suite/parts/inc/partition_crash_add.inc index fcd058562c0..43b0c5c88bd 100644 --- a/mysql-test/suite/parts/inc/partition_crash_add.inc +++ b/mysql-test/suite/parts/inc/partition_crash_add.inc @@ -1,33 +1,34 @@ # To be used with partition mgm commands like # ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING). --echo # Crash testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_add_partition_1"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_2"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_3"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_4"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_5"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_6"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_7"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_8"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_9"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_10"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/inc/partition_crash_change.inc b/mysql-test/suite/parts/inc/partition_crash_change.inc index ba9dd9cbdc8..501bc78a22d 100644 --- a/mysql-test/suite/parts/inc/partition_crash_change.inc +++ b/mysql-test/suite/parts/inc/partition_crash_change.inc @@ -2,39 +2,40 @@ # ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION. --echo # Test change partition (REORGANIZE/REBUILD/COALESCE --echo # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_change_partition_1"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_2"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_3"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_4"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_5"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_6"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_7"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_8"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_9"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_10"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_11"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_12"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/inc/partition_crash_drop.inc b/mysql-test/suite/parts/inc/partition_crash_drop.inc index 91787cdecdc..80730bb9008 100644 --- a/mysql-test/suite/parts/inc/partition_crash_drop.inc +++ b/mysql-test/suite/parts/inc/partition_crash_drop.inc @@ -1,30 +1,31 @@ # To be used with partition mgm commands like # ALTER TABLE t1 DROP PARTITION. --echo # Test DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_1"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_2"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_3"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_4"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_5"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_6"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_7"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_8"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_9"; --source suite/parts/inc/partition_crash.inc -SET SESSION debug_dbug="-d,crash_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/inc/partition_fail_add.inc b/mysql-test/suite/parts/inc/partition_fail_add.inc index 72978458e0b..a7b8dd8aeb4 100644 --- a/mysql-test/suite/parts/inc/partition_fail_add.inc +++ b/mysql-test/suite/parts/inc/partition_fail_add.inc @@ -1,33 +1,34 @@ # To be used with partition mgm commands like # ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING). --echo # Error recovery testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_add_partition_1"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_2"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_3"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_4"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_5"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_6"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_7"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_8"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_9"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_10"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/inc/partition_fail_change.inc b/mysql-test/suite/parts/inc/partition_fail_change.inc index 0c576d990fe..c10d5fecc2e 100644 --- a/mysql-test/suite/parts/inc/partition_fail_change.inc +++ b/mysql-test/suite/parts/inc/partition_fail_change.inc @@ -2,39 +2,40 @@ # ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION. --echo # Error recovery change partition (REORGANIZE/REBUILD/COALESCE --echo # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_change_partition_1"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_2"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_3"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_4"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_5"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_6"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_7"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_8"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_9"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_10"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_11"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_12"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/inc/partition_fail_drop.inc b/mysql-test/suite/parts/inc/partition_fail_drop.inc index ca9bcf7d7a3..df1d28b0bf9 100644 --- a/mysql-test/suite/parts/inc/partition_fail_drop.inc +++ b/mysql-test/suite/parts/inc/partition_fail_drop.inc @@ -1,30 +1,31 @@ # To be used with partition mgm commands like # ALTER TABLE t1 DROP PARTITION. --echo # Error recovery DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_1"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_2"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_3"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_4"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_5"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_6"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_7"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_8"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_9"; --source suite/parts/inc/partition_fail.inc -SET SESSION debug_dbug="-d,fail_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result index 891091efd58..7d712cc4d1e 100644 --- a/mysql-test/suite/parts/r/partition_debug_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_innodb.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1; # # Bug#12696518/Bug#11766879/60106:DIFF BETWEEN # OF INDEXES IN MYSQL # VS INNODB, PARTITONING, ON INDEX CREATE @@ -13,6 +12,7 @@ INSERT INTO t1 VALUES (3, 'row id 3'), (4, '4 row'), (5, 'row5'); INSERT INTO t1 VALUES (6, 'X 6 row'), (7, 'Seventh row'), (8, 'Last row'); ALTER TABLE t1 ADD INDEX new_b_index (b); ALTER TABLE t1 DROP INDEX new_b_index; +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug = "+d,ha_partition_fail_final_add_index"; ALTER TABLE t1 ADD INDEX (b); ERROR HY000: Table has no partition for value 0 @@ -59,7 +59,7 @@ a b 6 X 6 row 7 Seventh row 8 Last row -SET SESSION debug_dbug = "-d,ha_partition_fail_final_add_index"; +SET SESSION debug_dbug = @save_dbug; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -83,6 +83,7 @@ call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table "); call mtr.add_suppression("Attempting backtrace. You can use the following information to find out"); flush tables; # Crash testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_add_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -147,7 +148,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -214,7 +215,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -281,7 +282,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -348,7 +349,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -416,7 +417,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -484,7 +485,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -552,7 +553,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -622,7 +623,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -690,7 +691,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -758,8 +759,9 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; # Error recovery testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_add_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -880,7 +882,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1001,7 +1003,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1122,7 +1124,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1243,7 +1245,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1364,7 +1366,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1485,7 +1487,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1606,7 +1608,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1731,7 +1733,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1856,7 +1858,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -1981,8 +1983,9 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; # Test DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2046,7 +2049,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2112,7 +2115,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2178,7 +2181,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2238,7 +2241,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2298,7 +2301,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2358,7 +2361,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2416,7 +2419,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2473,7 +2476,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2530,8 +2533,9 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; # Error recovery DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2650,7 +2654,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2769,7 +2773,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2888,7 +2892,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -2995,7 +2999,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3102,7 +3106,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3209,7 +3213,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3316,7 +3320,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3423,7 +3427,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3530,9 +3534,10 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; # Test change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_change_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3598,7 +3603,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3666,7 +3671,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3734,7 +3739,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3804,7 +3809,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3874,7 +3879,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -3946,7 +3951,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4018,7 +4023,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4088,7 +4093,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4158,7 +4163,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4228,7 +4233,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4297,7 +4302,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4366,9 +4371,10 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; # Error recovery change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_change_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4491,7 +4497,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4614,7 +4620,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4737,7 +4743,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4860,7 +4866,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -4983,7 +4989,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5110,7 +5116,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5237,7 +5243,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5364,7 +5370,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5491,7 +5497,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5618,7 +5624,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5745,7 +5751,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'InnoDB' @@ -5872,4 +5878,4 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/r/partition_debug_myisam.result b/mysql-test/suite/parts/r/partition_debug_myisam.result index 2411d58169e..190900e8d90 100644 --- a/mysql-test/suite/parts/r/partition_debug_myisam.result +++ b/mysql-test/suite/parts/r/partition_debug_myisam.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1; # Test crash and failure recovery in fast_alter_partition_table. # # Bug#53676: Unexpected errors and possible table corruption on @@ -9,6 +8,7 @@ DROP TABLE IF EXISTS t1; call mtr.add_suppression("Attempting backtrace. You can use the following information to find out"); flush tables; # Crash testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_add_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -79,7 +79,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -152,7 +152,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -225,7 +225,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -298,7 +298,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -373,7 +373,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -448,7 +448,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -523,7 +523,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -601,7 +601,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -677,7 +677,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -753,8 +753,9 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; # Error recovery testing ADD PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_add_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -883,7 +884,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1012,7 +1013,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1141,7 +1142,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1270,7 +1271,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1399,7 +1400,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1528,7 +1529,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1657,7 +1658,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1792,7 +1793,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -1927,7 +1928,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2062,8 +2063,9 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_add_partition_10"; +SET SESSION debug_dbug=@save_dbug; # Test DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2133,7 +2135,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2205,7 +2207,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2277,7 +2279,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2342,7 +2344,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2407,7 +2409,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2472,7 +2474,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2535,7 +2537,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2596,7 +2598,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2657,8 +2659,9 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; # Error recovery DROP PARTITION +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2785,7 +2788,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -2912,7 +2915,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3039,7 +3042,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3152,7 +3155,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3265,7 +3268,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3378,7 +3381,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3491,7 +3494,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3604,7 +3607,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3717,9 +3720,10 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_drop_partition_9"; +SET SESSION debug_dbug=@save_dbug; # Test change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,crash_change_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3791,7 +3795,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3865,7 +3869,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -3939,7 +3943,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4017,7 +4021,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4095,7 +4099,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4176,7 +4180,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4257,7 +4261,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4336,7 +4340,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4415,7 +4419,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4494,7 +4498,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4571,7 +4575,7 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,crash_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4648,9 +4652,10 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; -SET SESSION debug_dbug="-d,crash_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; # Error recovery change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,fail_change_partition_1"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4781,7 +4786,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_1"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -4912,7 +4917,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_2"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5043,7 +5048,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_3"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5174,7 +5179,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_4"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5305,7 +5310,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_5"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5442,7 +5447,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_6"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5579,7 +5584,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_7"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5716,7 +5721,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_8"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5853,7 +5858,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_9"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -5990,7 +5995,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_10"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -6127,7 +6132,7 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_11"; +SET SESSION debug_dbug=@save_dbug; SET SESSION debug_dbug="+d,fail_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE = 'MyISAM' @@ -6264,4 +6269,4 @@ a b 4 Original from partition p0 UNLOCK TABLES; DROP TABLE t1; -SET SESSION debug_dbug="-d,fail_change_partition_12"; +SET SESSION debug_dbug=@save_dbug; diff --git a/mysql-test/suite/parts/t/partition_debug_innodb.test b/mysql-test/suite/parts/t/partition_debug_innodb.test index 33cbd8e3b7b..1724ad1c2a1 100644 --- a/mysql-test/suite/parts/t/partition_debug_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_innodb.test @@ -7,10 +7,6 @@ --source include/not_valgrind.inc --source include/not_embedded.inc ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - --let $DATADIR= `SELECT @@datadir;` --echo # @@ -29,6 +25,7 @@ INSERT INTO t1 VALUES (6, 'X 6 row'), (7, 'Seventh row'), (8, 'Last row'); ALTER TABLE t1 ADD INDEX new_b_index (b); ALTER TABLE t1 DROP INDEX new_b_index; +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug = "+d,ha_partition_fail_final_add_index"; --error ER_NO_PARTITION_FOR_GIVEN_VALUE @@ -44,7 +41,7 @@ SHOW CREATE TABLE t1; --sorted_result SELECT * FROM t1; -SET SESSION debug_dbug = "-d,ha_partition_fail_final_add_index"; +SET SESSION debug_dbug = @save_dbug; SHOW CREATE TABLE t1; DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_debug_myisam.test b/mysql-test/suite/parts/t/partition_debug_myisam.test index 98560827ca9..7626be602db 100644 --- a/mysql-test/suite/parts/t/partition_debug_myisam.test +++ b/mysql-test/suite/parts/t/partition_debug_myisam.test @@ -6,10 +6,6 @@ --source include/not_valgrind.inc --source include/not_embedded.inc ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - --let $DATADIR= `SELECT @@datadir;` let $engine= 'MyISAM'; diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test index 69e1a889b18..117501f0a49 100644 --- a/mysql-test/t/drop_bad_db_type.test +++ b/mysql-test/t/drop_bad_db_type.test @@ -7,6 +7,7 @@ if (!$HA_ARCHIVE_SO) { let $mysqld_datadir= `select @@datadir`; +SET @save_dbug = @@debug_dbug; set debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; @@ -21,5 +22,4 @@ drop table t1; --list_files $mysqld_datadir/test uninstall soname 'ha_archive'; -set debug_dbug='-d,unstable_db_type'; - +set debug_dbug=@save_dbug; diff --git a/mysql-test/t/drop_debug.test b/mysql-test/t/drop_debug.test index 21069b57285..4ba16f1cc20 100644 --- a/mysql-test/t/drop_debug.test +++ b/mysql-test/t/drop_debug.test @@ -10,17 +10,13 @@ --echo # -- --echo ---disable_warnings -DROP DATABASE IF EXISTS mysql_test; ---enable_warnings - ---echo CREATE DATABASE mysql_test; CREATE TABLE mysql_test.t1(a INT); CREATE TABLE mysql_test.t2(b INT); CREATE TABLE mysql_test.t3(c INT); --echo +SET @save_dbug = @@debug_dbug; SET SESSION debug_dbug= "+d,bug43138"; --echo @@ -28,7 +24,7 @@ SET SESSION debug_dbug= "+d,bug43138"; DROP DATABASE mysql_test; --echo -SET SESSION debug_dbug= "-d,bug43138"; +SET SESSION debug_dbug=@save_dbug; --echo --echo # -- diff --git a/mysql-test/t/partition_debug_sync.test b/mysql-test/t/partition_debug_sync.test index 027a4bd19a7..df4901ab78f 100644 --- a/mysql-test/t/partition_debug_sync.test +++ b/mysql-test/t/partition_debug_sync.test @@ -6,10 +6,7 @@ --source include/have_partition.inc --source include/have_debug_sync.inc ---disable_warnings -DROP TABLE IF EXISTS t1, t2; SET DEBUG_SYNC= 'RESET'; ---enable_warnings --echo # --echo # Bug#42438: Crash ha_partition::change_table_ptr @@ -30,6 +27,7 @@ ENGINE = MYISAM PARTITION p1 VALUES LESS THAN (20), PARTITION p2 VALUES LESS THAN (100), PARTITION p3 VALUES LESS THAN MAXVALUE ) */; +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug= "+d,sleep_before_create_table_no_lock"; SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter'; SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed'; @@ -43,7 +41,7 @@ DROP TABLE IF EXISTS t1; --echo # Con 1 connection con1; --reap -SET SESSION debug_dbug= "-d,sleep_before_create_table_no_lock"; +SET SESSION debug_dbug=@save_dbug; connection default; SET DEBUG_SYNC= 'RESET'; connection con1; @@ -70,12 +68,13 @@ SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done'; --send ALTER TABLE t2 REMOVE PARTITIONING connection default; --echo # Con default +SET @save_dbug=@@debug_dbug; SET SESSION debug_dbug= "+d,sleep_before_no_locks_delete_table"; SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions'; SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter'; SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done'; DROP TABLE IF EXISTS t2; -SET SESSION debug_dbug= "-d,sleep_before_no_locks_delete_table"; +SET SESSION debug_dbug=@save_dbug; --echo # Con 1 connection con1; --error ER_NO_SUCH_TABLE diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index d4b63a73920..129a68204ba 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -696,9 +696,10 @@ END| delimiter ;| +SET @save_dbug = @@debug_dbug; SET SESSION debug_dbug="+d,bug23032_emit_warning"; CALL p1(); -SET SESSION debug_dbug="-d,bug23032_emit_warning"; +SET SESSION debug_dbug=@save_dbug; DROP PROCEDURE p1; DROP TABLE t1; -- cgit v1.2.1 From ea61b79694ee9fcc32e75966ee93c076443f16b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 14:12:36 +0300 Subject: MDEV-20805 ibuf_add_free_page() is not initializing FIL_PAGE_TYPE first In the function recv_parse_or_apply_log_rec_body() there are debug checks for validating the state of the page when redo log records are being applied. Most notably, FIL_PAGE_TYPE should be set before anything else is being written to the page. ibuf_add_free_page(): Set FIL_PAGE_TYPE before performing any other changes. --- storage/innobase/ibuf/ibuf0ibuf.c | 7 ++++--- storage/xtradb/ibuf/ibuf0ibuf.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index cbbe88cc130..4dc85f209d5 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2222,14 +2223,14 @@ ibuf_add_free_page(void) buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); page = buf_block_get_frame(block); + mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST, + MLOG_2BYTES, &mtr); + /* Add the page to the free list and update the ibuf size data */ flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); - mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST, - MLOG_2BYTES, &mtr); - ibuf->seg_size++; ibuf->free_list_len++; diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c index 1cf427024bf..0b2bd2107e5 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.c +++ b/storage/xtradb/ibuf/ibuf0ibuf.c @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2266,14 +2267,14 @@ ibuf_add_free_page(void) buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); page = buf_block_get_frame(block); + mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST, + MLOG_2BYTES, &mtr); + /* Add the page to the free list and update the ibuf size data */ flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); - mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST, - MLOG_2BYTES, &mtr); - ibuf->seg_size++; ibuf->free_list_len++; -- cgit v1.2.1 From c0c003beb48b099b5e6516e9d36adf096cd2d09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 15:32:04 +0300 Subject: MDEV-20805 follow-up: Catch writes of bogus pages buf_flush_init_for_writing(): Assert that FIL_PAGE_TYPE is set except when creating a new data file with a dummy first page. buf_dblwr_create(): Ensure that FIL_PAGE_TYPE on all pages will be initialized. Reset buf_dblwr_being_created at the end. --- storage/innobase/buf/buf0dblwr.cc | 10 +++++++++- storage/innobase/buf/buf0flu.cc | 3 ++- storage/xtradb/buf/buf0dblwr.cc | 10 +++++++++- storage/xtradb/buf/buf0flu.cc | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 99582685d04..36054dbf9fe 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -291,6 +291,13 @@ too_small: ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1); page_no = buf_block_get_page_no(new_block); + /* We only do this in the debug build, to ensure that + both the check in buf_flush_init_for_writing() and + recv_parse_or_apply_log_rec_body() will see a valid + page type. The flushes of new_block are actually + unnecessary here. */ + ut_d(mlog_write_ulint(FIL_PAGE_TYPE + new_block->frame, + FIL_PAGE_TYPE_SYS, MLOG_2BYTES, &mtr)); if (i == FSP_EXTENT_SIZE / 2) { ut_a(page_no == FSP_EXTENT_SIZE); @@ -353,6 +360,7 @@ too_small: /* Flush the modified pages to disk and make a checkpoint */ log_make_checkpoint_at(LSN_MAX, TRUE); + buf_dblwr_being_created = FALSE; /* Remove doublewrite pages from LRU */ buf_pool_invalidate(); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 2e352c3de72..f918b88a5ea 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -745,6 +745,7 @@ buf_flush_init_for_writing( ib_uint32_t checksum = 0 /* silence bogus gcc warning */; ut_ad(page); + ut_ad(!newest_lsn || fil_page_get_type(page)); if (page_zip_) { page_zip_des_t* page_zip; diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index 6e0c6fb612e..c3a169d45ef 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -291,6 +291,13 @@ too_small: ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1); page_no = buf_block_get_page_no(new_block); + /* We only do this in the debug build, to ensure that + both the check in buf_flush_init_for_writing() and + recv_parse_or_apply_log_rec_body() will see a valid + page type. The flushes of new_block are actually + unnecessary here. */ + ut_d(mlog_write_ulint(FIL_PAGE_TYPE + new_block->frame, + FIL_PAGE_TYPE_SYS, MLOG_2BYTES, &mtr)); if (i == FSP_EXTENT_SIZE / 2) { ut_a(page_no == FSP_EXTENT_SIZE); @@ -353,6 +360,7 @@ too_small: /* Flush the modified pages to disk and make a checkpoint */ log_make_checkpoint_at(LSN_MAX, TRUE); + buf_dblwr_being_created = FALSE; /* Remove doublewrite pages from LRU */ buf_pool_invalidate(); diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index 96ab72a2636..e4512cacff8 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -787,6 +787,7 @@ buf_flush_init_for_writing( ib_uint32_t checksum = 0 /* silence bogus gcc warning */; ut_ad(page); + ut_ad(!newest_lsn || fil_page_get_type(page)); if (page_zip_) { page_zip_des_t* page_zip; -- cgit v1.2.1 From 1fd1ef25c25feb00a5be8dec4ca540fc427ef6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 18:36:08 +0300 Subject: Fix CMAKE_BUILD_TYPE=Debug Remove unused variables and type mismatch that was introduced in commit b393e2cb0c079b30563dcc87a62002c9c778643c Also, fix a typo in the documentation of the parameter, and update the test. --- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 12 ++++++++ storage/innobase/handler/ha_innodb.cc | 4 +-- storage/innobase/include/que0que.h | 4 +-- storage/innobase/que/que0que.cc | 3 -- storage/innobase/srv/srv0srv.cc | 34 +++++++++++------------ 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 79d24242435..1808cfb6ea3 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -642,6 +642,18 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_DEBUG_SYNC +SESSION_VALUE NULL +DEFAULT_VALUE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT debug_sync for innodb purge threads. Use it to set up sync points for all purge threads at once. The commands will be applied sequentially at the beginning of purging the next undo record. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID SESSION_VALUE 1 DEFAULT_VALUE 1 diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index df8e0c5ee10..a18b6215417 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -21015,9 +21015,9 @@ char *innobase_debug_sync; static MYSQL_SYSVAR_STR(debug_sync, innobase_debug_sync, PLUGIN_VAR_NOCMDARG, "debug_sync for innodb purge threads. " - "Use it t oset up sync points for all purge threads " + "Use it to set up sync points for all purge threads " "at once. The commands will be applied sequentially at " - "the beginning of purging the next node ", + "the beginning of purging the next undo record.", NULL, innobase_debug_sync_set, NULL); #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 3e23978f54c..8489551e64d 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -386,8 +386,8 @@ struct que_thr_t{ row_prebuilt_t* prebuilt; /*!< prebuilt structure processed by the query thread */ - ut_d(srv_slot_t *thread_slot;) /*!< a slot from srv_sys.sys_threads - * if any */ + /** a slot of srv_sys.sys_threads, for DEBUG_SYNC in purge thread */ + ut_d(srv_slot_t* thread_slot;) }; #define QUE_THR_MAGIC_N 8476583 diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 96f90d63759..1d3d1573299 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -1082,9 +1082,6 @@ que_run_threads_low( ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_ad(!trx_mutex_own(thr_get_trx(thr))); - /* slot can be received from purge thread for debug_sync setup */ - ut_d(srv_slot_t *slot = thr->thread_slot); - /* cumul_resource counts how much resources the OS thread (NOT the query thread) has spent in this function */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 16efe4a6a34..42e026df7e4 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3047,18 +3047,18 @@ srv_was_tablespace_truncated(const fil_space_t* space) } #ifdef UNIV_DEBUG -static uint get_first_slot(srv_thread_type type) +static ulint get_first_slot(srv_thread_type type) { switch (type) { - case SRV_MASTER: - return SRV_MASTER_SLOT; - case SRV_PURGE: - return SRV_PURGE_SLOT; - case SRV_WORKER: - /* Find an empty slot, skip the master and purge slots. */ - return SRV_WORKER_SLOTS_START; - default: - ut_error; + case SRV_MASTER: + return SRV_MASTER_SLOT; + case SRV_PURGE: + return SRV_PURGE_SLOT; + case SRV_WORKER: + /* Find an empty slot, skip the master and purge slots. */ + return SRV_WORKER_SLOTS_START; + default: + ut_error; } } @@ -3066,14 +3066,12 @@ void srv_for_each_thread(srv_thread_type type, srv_slot_callback_t callback, const void *arg) { - int slot_idx= get_first_slot(type); - while(slot_idx < srv_sys.n_sys_threads - && srv_sys.sys_threads[slot_idx].in_use - && srv_sys.sys_threads[slot_idx].type == type) - { - srv_slot_t *slot= &srv_sys.sys_threads[slot_idx]; - callback(slot, arg); - slot_idx++; + for (ulint slot_idx= get_first_slot(type); + slot_idx < srv_sys.n_sys_threads + && srv_sys.sys_threads[slot_idx].in_use + && srv_sys.sys_threads[slot_idx].type == type; + slot_idx++) { + callback(&srv_sys.sys_threads[slot_idx], arg); } } #endif -- cgit v1.2.1 From 1e1b53ccfd0a09dbb0fe7fb10831669617339f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 21:24:48 +0300 Subject: After-merge fix: Correct an assertion During IMPORT TABLESPACE, we do invoke buf_flush_init_for_writing() with block==NULL and newest_lsn!=0. --- storage/innobase/buf/buf0flu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 5df1b9e286b..32d5ba34ddb 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -854,7 +854,7 @@ buf_flush_init_for_writing( ut_ad(block == NULL || block->frame == page); ut_ad(block == NULL || page_zip_ == NULL || &block->page.zip == page_zip_); - ut_ad(!srv_safe_truncate || !block == !newest_lsn); + ut_ad(!srv_safe_truncate || !block || newest_lsn); ut_ad(page); ut_ad(!srv_safe_truncate || !newest_lsn || fil_page_get_type(page)); -- cgit v1.2.1 From 38736928e7980519a5975670fe0f95afff9c667c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 11 Oct 2019 21:26:16 +0300 Subject: Fix -std=c++98 -Wzero-length-array This is another follow-up fix to commit b393e2cb0c079b30563dcc87a62002c9c778643c which turned out to be still broken. Replace the C++11 keyword 'constexpr' with #define. debug_sync_t::str: Remove the zero-length array. Replace sync->str with reinterpret_cast(&sync[1]). --- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/include/srv0srv.h | 9 +++------ storage/innobase/row/row0purge.cc | 5 +++-- storage/innobase/srv/srv0srv.cc | 6 +++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a18b6215417..a556b5875df 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19388,7 +19388,7 @@ innobase_debug_sync_callback(srv_slot_t *slot, const void *value) // One allocatoin for list node object and value. void *buf = ut_malloc_nokey(sizeof(srv_slot_t::debug_sync_t) + len); srv_slot_t::debug_sync_t *sync = new(buf) srv_slot_t::debug_sync_t(); - strcpy(sync->str, value_str); + strcpy(reinterpret_cast(&sync[1]), value_str); rw_lock_x_lock(&slot->debug_sync_lock); UT_LIST_ADD_LAST(slot->debug_sync, sync); diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index dbed637aa0d..c1dcb2273e6 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -615,7 +615,7 @@ extern ulong srv_fatal_semaphore_wait_threshold; /** Buffer pool dump status frequence in percentages */ extern ulong srv_buf_dump_status_frequency; -constexpr uint srv_max_purge_threads = 32; +#define srv_max_purge_threads 32 # ifdef UNIV_PFS_THREAD /* Keys to register InnoDB threads with performance schema */ @@ -1132,12 +1132,9 @@ struct srv_slot_t{ (only used for user threads) */ #ifdef UNIV_DEBUG struct debug_sync_t { - UT_LIST_NODE_T(debug_sync_t) - debug_sync_list; - char str[0]; + UT_LIST_NODE_T(debug_sync_t) debug_sync_list; }; - UT_LIST_BASE_NODE_T(debug_sync_t) - debug_sync; + UT_LIST_BASE_NODE_T(debug_sync_t) debug_sync; rw_lock_t debug_sync_lock; #endif }; diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 525f8e0c18e..42aa6123cd6 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1218,9 +1218,10 @@ row_purge_step( while (UT_LIST_GET_LEN(slot->debug_sync)) { srv_slot_t::debug_sync_t *sync = UT_LIST_GET_FIRST(slot->debug_sync); + const char* sync_str = reinterpret_cast(&sync[1]); bool result = debug_sync_set_action(current_thd, - sync->str, - strlen(sync->str)); + sync_str, + strlen(sync_str)); ut_a(!result); UT_LIST_REMOVE(slot->debug_sync, sync); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 42e026df7e4..2c33496ca52 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -663,14 +663,14 @@ char srv_buffer_pool_dump_at_shutdown = TRUE; char srv_buffer_pool_load_at_startup = TRUE; /** Slot index in the srv_sys.sys_threads array for the master thread. */ -constexpr ulint SRV_MASTER_SLOT = 0; +#define SRV_MASTER_SLOT 0 /** Slot index in the srv_sys.sys_threads array for the purge thread. */ -constexpr ulint SRV_PURGE_SLOT = 1; +#define SRV_PURGE_SLOT 1 /** Slot index in the srv_sys.sys_threads array from which purge workers start. */ -constexpr ulint SRV_WORKER_SLOTS_START = 2; +#define SRV_WORKER_SLOTS_START 2 #ifdef HAVE_PSI_STAGE_INTERFACE /** Performance schema stage event for monitoring ALTER TABLE progress -- cgit v1.2.1 From 4ca0abe96409857bda9eccfd0dc8d6632c46679a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 7 Oct 2019 12:34:08 +0200 Subject: MDEV-20728: /usr/sbin/mysqld: unknown variable 'defaults-group-suffix=mysqld1 When the mysqld_multi script passes the --defaults-group-suffix option to mysqld, it must remove the initial substring with the group name ("mysqld") from option value, because otherwise substring "mysqld" will be added to the group name and then the group name will contain the word "mysqld" twice, which is wrong, because mysqld itself adds the suffix received to the group name. --- scripts/mysqld_multi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 748925bef0b..2c3578834eb 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -372,7 +372,7 @@ sub start_mysqlds() if (!$suffix_found) { $com.= " --defaults-group-suffix="; - $com.= $groups[$i]; + $com.= substr($groups[$i],6); } $com.= $tmp; -- cgit v1.2.1 From 2ae02c295adf9cbfd9dd29ed6872b2e6295eee55 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 7 Oct 2019 12:34:08 +0200 Subject: MDEV-20728: /usr/sbin/mysqld: unknown variable 'defaults-group-suffix=mysqld1 When the mysqld_multi script passes the --defaults-group-suffix option to mysqld, it must remove the initial substring with the group name ("mysqld") from option value, because otherwise substring "mysqld" will be added to the group name and then the group name will contain the word "mysqld" twice, which is wrong, because mysqld itself adds the suffix received to the group name. --- scripts/mysqld_multi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 7cf22bdaf3c..5f359551f0d 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -372,7 +372,7 @@ sub start_mysqlds() if (!$suffix_found) { $com.= " --defaults-group-suffix="; - $com.= $groups[$i]; + $com.= substr($groups[$i],6); } $com.= $tmp; -- cgit v1.2.1