summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/btr/btr0btr.cc13
-rw-r--r--storage/innobase/btr/btr0cur.cc21
-rw-r--r--storage/innobase/btr/btr0sea.cc20
-rw-r--r--storage/innobase/buf/buf0buf.cc19
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/dict/dict0dict.cc1
-rw-r--r--storage/innobase/handler/ha_innodb.cc48
-rw-r--r--storage/innobase/handler/handler0alter.cc5
-rw-r--r--storage/innobase/include/rem0rec.h7
-rw-r--r--storage/innobase/include/srv0srv.h25
-rw-r--r--storage/innobase/log/log0log.cc3
-rw-r--r--storage/innobase/log/log0recv.cc5
-rw-r--r--storage/innobase/row/row0ins.cc10
-rw-r--r--storage/innobase/row/row0mysql.cc2
-rw-r--r--storage/innobase/row/row0vers.cc8
-rw-r--r--storage/innobase/srv/srv0srv.cc100
-rw-r--r--storage/innobase/srv/srv0start.cc4
-rw-r--r--storage/innobase/trx/trx0roll.cc8
-rw-r--r--storage/innobase/trx/trx0trx.cc5
19 files changed, 109 insertions, 199 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index a8e319dd321..7ff0820dd13 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -5164,11 +5164,14 @@ loop:
mtr_release_block_at_savepoint(
&mtr, savepoint, right_block);
- btr_block_get(
- page_id_t(index->table->space_id,
- parent_right_page_no),
- zip_size,
- RW_SX_LATCH, index, &mtr);
+ if (parent_right_page_no != FIL_NULL) {
+ btr_block_get(
+ page_id_t(index->table
+ ->space_id,
+ parent_right_page_no),
+ zip_size,
+ RW_SX_LATCH, index, &mtr);
+ }
right_block = btr_block_get(
page_id_t(index->table->space_id,
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 8c657bc341b..5696d184386 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -775,6 +775,7 @@ btr_cur_optimistic_latch_leaves(
{
ulint mode;
ulint left_page_no;
+ ulint curr_page_no;
switch (*latch_mode) {
case BTR_SEARCH_LEAF:
@@ -801,16 +802,32 @@ btr_cur_optimistic_latch_leaves(
goto unpin_failed;
}
+
+ curr_page_no = block->page.id.page_no();
left_page_no = btr_page_get_prev(
buf_block_get_frame(block));
rw_lock_s_unlock(&block->lock);
if (left_page_no != FIL_NULL) {
- cursor->left_block = btr_block_get(
+ dberr_t err = DB_SUCCESS;
+ cursor->left_block = buf_page_get_gen(
page_id_t(cursor->index->table->space_id,
left_page_no),
cursor->index->table->space->zip_size(),
- mode, cursor->index, mtr);
+ mode, nullptr, BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, mtr, &err);
+
+ if (err == DB_DECRYPTION_FAILED) {
+ cursor->index->table->file_unreadable = true;
+ }
+
+ if (btr_page_get_next(cursor->left_block->frame)
+ != curr_page_no) {
+ /* release the left block */
+ btr_leaf_page_release(
+ cursor->left_block, mode, mtr);
+ goto unpin_failed;
+ }
} else {
cursor->left_block = NULL;
}
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index c92659e9d71..31937f7b0fb 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1142,26 +1142,6 @@ retry:
ut_ad(block->page.id.space() == index->table->space_id);
ut_a(index_id == index->id);
ut_ad(!dict_index_is_ibuf(index));
-#ifdef UNIV_DEBUG
- switch (dict_index_get_online_status(index)) {
- case ONLINE_INDEX_CREATION:
- /* The index is being created (bulk loaded). */
- case ONLINE_INDEX_COMPLETE:
- /* The index has been published. */
- case ONLINE_INDEX_ABORTED:
- /* Either the index creation was aborted due to an
- error observed by InnoDB (in which case there should
- not be any adaptive hash index entries), or it was
- completed and then flagged aborted in
- rollback_inplace_alter_table(). */
- break;
- case ONLINE_INDEX_ABORTED_DROPPED:
- /* The index should have been dropped from the tablespace
- already, and the adaptive hash index entries should have
- been dropped as well. */
- ut_error;
- }
-#endif /* UNIV_DEBUG */
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index e4b1953e1e3..905c04fa811 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -5609,15 +5609,30 @@ buf_page_create(
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
ut_d(block->page.file_page_was_freed = FALSE);
+#ifdef BTR_CUR_HASH_ADAPT
+ bool drop_hash_entry =
+ (block->page.state == BUF_BLOCK_FILE_PAGE
+ && block->index);
+
+ if (drop_hash_entry) {
+ mutex_enter(&block->mutex);
+ buf_page_set_sticky(&block->page);
+ mutex_exit(&block->mutex);
+ }
+#endif
/* Page can be found in buf_pool */
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(hash_lock);
buf_block_free(free_block);
#ifdef BTR_CUR_HASH_ADAPT
- if (block->page.state == BUF_BLOCK_FILE_PAGE
- && UNIV_LIKELY_NULL(block->index)) {
+ if (drop_hash_entry) {
btr_search_drop_page_hash_index(block);
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&block->mutex);
+ buf_page_unset_sticky(&block->page);
+ mutex_exit(&block->mutex);
+ buf_pool_mutex_exit(buf_pool);
}
#endif /* BTR_CUR_HASH_ADAPT */
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 45c9b661d6f..9b49b9570e2 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -3079,7 +3079,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
/* The page_cleaner skips sleep if the server is
idle and there are no pending IOs in the buffer pool
and there is work to do. */
- if (srv_check_activity(last_activity)
+ if (srv_check_activity(&last_activity)
|| buf_get_n_pending_read_ios()
|| n_flushed == 0) {
@@ -3171,7 +3171,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
n_flushed = n_flushed_lru + n_flushed_list;
- } else if (srv_check_activity(last_activity)) {
+ } else if (srv_check_activity(&last_activity)) {
ulint n_to_flush;
lsn_t lsn_limit = 0;
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 3bf701b556a..38eeacf0f6e 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -5307,6 +5307,7 @@ dict_set_corrupted_index_cache_only(
is corrupted */
if (dict_index_is_clust(index)) {
index->table->corrupted = TRUE;
+ index->table->file_unreadable = true;
}
index->type |= DICT_CORRUPT;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index bda81bc6ac6..67df52db9fc 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -431,14 +431,6 @@ TYPELIB innodb_flush_method_typelib = {
NULL
};
-/* The following counter is used to convey information to InnoDB
-about server activity: in case of normal DML ops it is not
-sensible to call srv_active_wake_master_thread after each
-operation, we only do it every INNOBASE_WAKE_INTERVAL'th step. */
-
-#define INNOBASE_WAKE_INTERVAL 32
-static ulong innobase_active_counter = 0;
-
/** Allowed values of innodb_change_buffering */
static const char* innodb_change_buffering_names[] = {
"none", /* IBUF_USE_NONE */
@@ -1838,23 +1830,6 @@ static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
#endif /* WITH_WSREP */
/********************************************************************//**
-Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth
-time calls srv_active_wake_master_thread. This function should be used
-when a single database operation may introduce a small need for
-server utility activity, like checkpointing. */
-inline
-void
-innobase_active_small(void)
-/*=======================*/
-{
- innobase_active_counter++;
-
- if ((innobase_active_counter % INNOBASE_WAKE_INTERVAL) == 0) {
- srv_active_wake_master_thread();
- }
-}
-
-/********************************************************************//**
Converts an InnoDB error code to a MySQL error code and also tells to MySQL
about a possible transaction rollback inside InnoDB caused by a lock wait
timeout or a deadlock.
@@ -6487,11 +6462,6 @@ ha_innobase::close()
MONITOR_INC(MONITOR_TABLE_CLOSE);
- /* Tell InnoDB server that there might be work for
- utility threads: */
-
- srv_active_wake_master_thread();
-
DBUG_RETURN(0);
}
@@ -8189,8 +8159,6 @@ report_error:
}
func_exit:
- innobase_active_small();
-
DBUG_RETURN(error_result);
}
@@ -8870,11 +8838,6 @@ func_exit:
error, m_prebuilt->table->flags, m_user_thd);
}
- /* Tell InnoDB server that there might be work for
- utility threads: */
-
- innobase_active_small();
-
#ifdef WITH_WSREP
if (error == DB_SUCCESS && trx->is_wsrep()
&& wsrep_thd_is_local(m_user_thd)
@@ -8936,11 +8899,6 @@ ha_innobase::delete_row(
innobase_srv_conc_exit_innodb(m_prebuilt);
- /* Tell the InnoDB server that there might be work for
- utility threads: */
-
- innobase_active_small();
-
#ifdef WITH_WSREP
if (error == DB_SUCCESS && trx->is_wsrep()
&& wsrep_thd_is_local(m_user_thd)
@@ -12756,7 +12714,6 @@ create_table_info_t::create_table_update_dict()
if (m_flags2 & DICT_TF2_FTS) {
if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) {
dict_table_close(innobase_table, FALSE, FALSE);
- srv_active_wake_master_thread();
trx_free(m_trx);
DBUG_RETURN(-1);
}
@@ -12906,11 +12863,6 @@ ha_innobase::create(
error = info.create_table_update_dict();
- /* Tell the InnoDB server that there might be work for
- utility threads: */
-
- srv_active_wake_master_thread();
-
DBUG_RETURN(error);
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 840d8c2d062..3f63cc82f89 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -11236,11 +11236,6 @@ foreign_fail:
log_append_on_checkpoint(NULL);
- /* Tell the InnoDB server that there might be work for
- utility threads: */
-
- srv_active_wake_master_thread();
-
if (fail) {
for (inplace_alter_handler_ctx** pctx = ctx_array;
*pctx; pctx++) {
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index 23c25f76362..a3fc72c1d7e 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -887,8 +887,11 @@ rec_get_nth_cfield(
ulint n,
ulint* len)
{
- ut_ad(rec_offs_validate(rec, index, offsets));
-
+ /* Because this function may be invoked by innobase_rec_to_mysql()
+ for reporting a duplicate key during ALTER TABLE or
+ CREATE UNIQUE INDEX, and in that case the rec omit the fixed-size
+ header of 5 or 6 bytes, the check
+ rec_offs_validate(rec, index, offsets) must be avoided here. */
if (!rec_offs_nth_default(offsets, n)) {
return rec_get_nth_field(rec, offsets, n, len);
}
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index e1d37613dc9..961d6aa1073 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -784,19 +784,6 @@ srv_reset_io_thread_op_info();
/** Wake up the purge threads if there is work to do. */
void
srv_wake_purge_thread_if_not_active();
-/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
-void
-srv_active_wake_master_thread_low();
-
-#define srv_active_wake_master_thread() \
- do { \
- if (!srv_read_only_mode) { \
- srv_active_wake_master_thread_low(); \
- } \
- } while (0)
-/** Wake up the master thread if it is suspended or being suspended. */
-void
-srv_wake_master_thread();
/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@@ -825,13 +812,13 @@ reading this value as it is only used in heuristics.
ulint
srv_get_activity_count(void);
/*========================*/
-/*******************************************************************//**
-Check if there has been any activity.
+
+/** Check if there has been any activity.
+@param[in,out] activity_count recent activity count to be returned
+if there is a change
@return FALSE if no change in activity counter. */
-ibool
-srv_check_activity(
-/*===============*/
- ulint old_activity_count); /*!< old activity count */
+bool srv_check_activity(ulint *activity_count);
+
/******************************************************************//**
Increment the server activity counter. */
void
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 54ee05fba26..8e0fe582c84 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -1714,6 +1714,9 @@ wait_suspend_loop:
"Waiting for page cleaner");
ib::info() << "Waiting for page_cleaner to "
"finish flushing of buffer pool";
+ /* This is a workaround to avoid the InnoDB hang
+ when OS datetime changed backwards */
+ os_event_set(buf_flush_event);
count = 0;
}
}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 705e39c40dd..42b194b3d3f 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2793,8 +2793,9 @@ loop:
if (lsn == checkpoint_lsn) {
if (recv_sys.mlog_checkpoint_lsn) {
- ut_ad(recv_sys.mlog_checkpoint_lsn
- <= recv_sys.recovered_lsn);
+ /* There can be multiple
+ MLOG_CHECKPOINT lsn for the
+ same checkpoint. */
break;
}
recv_sys.mlog_checkpoint_lsn
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index ca4b64c94b7..9a70f749041 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2225,8 +2225,14 @@ row_ins_duplicate_online(
return(DB_SUCCESS);
}
- if (fields == n_uniq + 2) {
- /* rec is an exact match of entry. */
+ ulint trx_id_len;
+
+ if (fields == n_uniq + 2
+ && memcmp(rec_get_nth_field(rec, offsets, n_uniq, &trx_id_len),
+ reset_trx_id, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)) {
+ ut_ad(trx_id_len == DATA_TRX_ID_LEN);
+ /* rec is an exact match of entry, and DB_TRX_ID belongs
+ to a transaction that started after our ALTER TABLE. */
return(DB_SUCCESS_LOCKED_REC);
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index e80e7889d19..ac5986243d6 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3811,7 +3811,7 @@ funct_exit_all_freed:
trx->op_info = "";
- srv_wake_master_thread();
+ srv_inc_activity_count();
DBUG_RETURN(err);
}
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index 4bbe0c8d717..6f070f7c7d8 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -93,7 +93,7 @@ row_vers_impl_x_locked_low(
trx_id_t trx_id;
rec_t* prev_version = NULL;
rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE];
- rec_offs* clust_offsets = clust_offsets_;
+ rec_offs* clust_offsets;
mem_heap_t* heap;
dtuple_t* ientry = NULL;
mem_heap_t* v_heap = NULL;
@@ -115,7 +115,7 @@ row_vers_impl_x_locked_low(
heap = mem_heap_create(1024);
- clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets,
+ clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets_,
true, ULINT_UNDEFINED, &heap);
trx_id = row_get_rec_trx_id(clust_rec, clust_index, clust_offsets);
@@ -204,7 +204,7 @@ row_vers_impl_x_locked_low(
ut_ad(committed || prev_version
|| !rec_get_deleted_flag(version, comp));
- /* Free version. */
+ /* Free version and clust_offsets. */
mem_heap_free(old_heap);
if (committed) {
@@ -239,7 +239,7 @@ not_locked:
}
clust_offsets = rec_get_offsets(
- prev_version, clust_index, clust_offsets, true,
+ prev_version, clust_index, clust_offsets_, true,
ULINT_UNDEFINED, &heap);
vers_del = rec_get_deleted_flag(prev_version, comp);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index ab47157ee9b..0bd52cb486d 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1910,33 +1910,6 @@ srv_get_active_thread_type(void)
return(ret);
}
-/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
-void
-srv_active_wake_master_thread_low()
-{
- ut_ad(!srv_read_only_mode);
- ut_ad(!mutex_own(&srv_sys.mutex));
-
- srv_inc_activity_count();
-
- if (srv_sys.n_threads_active[SRV_MASTER] == 0) {
- srv_slot_t* slot;
-
- srv_sys_mutex_enter();
-
- slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
-
- /* Only if the master thread has been started. */
-
- if (slot->in_use) {
- ut_a(srv_slot_get_type(slot) == SRV_MASTER);
- os_event_set(slot->event);
- }
-
- srv_sys_mutex_exit();
- }
-}
-
/** Wake up the purge threads if there is work to do. */
void
srv_wake_purge_thread_if_not_active()
@@ -1952,14 +1925,6 @@ srv_wake_purge_thread_if_not_active()
}
}
-/** Wake up the master thread if it is suspended or being suspended. */
-void
-srv_wake_master_thread()
-{
- srv_inc_activity_count();
- srv_release_threads(SRV_MASTER, 1);
-}
-
/*******************************************************************//**
Get current server activity count. We don't hold srv_sys::mutex while
reading this value as it is only used in heuristics.
@@ -1971,15 +1936,20 @@ srv_get_activity_count(void)
return(srv_sys.activity_count);
}
-/*******************************************************************//**
-Check if there has been any activity.
+/** Check if there has been any activity.
+@param[in,out] activity_count recent activity count to be returned
+if there is a change
@return FALSE if no change in activity counter. */
-ibool
-srv_check_activity(
-/*===============*/
- ulint old_activity_count) /*!< in: old activity count */
+bool srv_check_activity(ulint *activity_count)
{
- return(srv_sys.activity_count != old_activity_count);
+ ulint new_activity_count= srv_sys.activity_count;
+ if (new_activity_count != *activity_count)
+ {
+ *activity_count= new_activity_count;
+ return true;
+ }
+
+ return false;
}
/********************************************************************//**
@@ -2284,6 +2254,10 @@ srv_master_do_idle_tasks(void)
log_checkpoint(true);
MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND,
counter_time);
+
+ /* This is a workaround to avoid the InnoDB hang when OS datetime
+ changed backwards.*/
+ os_event_set(buf_flush_event);
}
/** Perform shutdown tasks.
@@ -2372,48 +2346,30 @@ DECLARE_THREAD(srv_master_thread)(
slot = srv_reserve_slot(SRV_MASTER);
ut_a(slot == srv_sys.sys_threads);
-loop:
while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
srv_master_sleep();
MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
- if (srv_check_activity(old_activity_count)) {
- old_activity_count = srv_get_activity_count();
+ if (srv_check_activity(&old_activity_count)) {
srv_master_do_active_tasks();
} else {
srv_master_do_idle_tasks();
}
}
- switch (srv_shutdown_state) {
- case SRV_SHUTDOWN_NONE:
- case SRV_SHUTDOWN_INITIATED:
- break;
- case SRV_SHUTDOWN_FLUSH_PHASE:
- case SRV_SHUTDOWN_LAST_PHASE:
- ut_ad(0);
- /* fall through */
- case SRV_SHUTDOWN_EXIT_THREADS:
- /* srv_init_abort() must have been invoked */
- case SRV_SHUTDOWN_CLEANUP:
- if (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP
- && srv_fast_shutdown < 2) {
- srv_shutdown(srv_fast_shutdown == 0);
- }
- srv_suspend_thread(slot);
- my_thread_end();
- os_thread_exit();
- }
+ ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS
+ || srv_shutdown_state == SRV_SHUTDOWN_CLEANUP);
- srv_main_thread_op_info = "suspending";
+ if (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP
+ && srv_fast_shutdown < 2) {
+ srv_shutdown(srv_fast_shutdown == 0);
+ }
srv_suspend_thread(slot);
-
- srv_main_thread_op_info = "waiting for server activity";
-
- srv_resume_thread(slot);
- goto loop;
+ my_thread_end();
+ os_thread_exit();
+ OS_THREAD_DUMMY_RETURN;
}
/** @return whether purge should exit due to shutdown */
@@ -2581,15 +2537,13 @@ static uint32_t srv_do_purge(ulint* n_total_purged
++n_use_threads;
}
- } else if (srv_check_activity(old_activity_count)
+ } else if (srv_check_activity(&old_activity_count)
&& n_use_threads > 1) {
/* History length same or smaller since last snapshot,
use fewer threads. */
--n_use_threads;
-
- old_activity_count = srv_get_activity_count();
}
/* Ensure that the purge threads are less than what
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 746935f5794..42d757d1a84 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1088,7 +1088,7 @@ srv_shutdown_all_bg_threads()
if (srv_start_state_is_set(SRV_START_STATE_MASTER)) {
/* c. We wake the master thread so that
it exits */
- srv_wake_master_thread();
+ srv_inc_activity_count();
}
if (srv_start_state_is_set(SRV_START_STATE_PURGE)) {
@@ -2420,7 +2420,7 @@ void srv_shutdown_bg_undo_sources()
fts_optimize_shutdown();
dict_stats_shutdown();
while (row_get_background_drop_list_len_low()) {
- srv_wake_master_thread();
+ srv_inc_activity_count();
os_thread_yield();
}
srv_undo_sources = false;
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 0e60c6fb745..917274d5f0d 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -62,7 +62,7 @@ static bool trx_rollback_finish(trx_t* trx)
trx->commit();
} else {
ut_a(trx->error_state == DB_INTERRUPTED);
- ut_ad(!srv_is_being_started);
+ ut_ad(srv_shutdown_state != SRV_SHUTDOWN_NONE);
ut_a(!srv_undo_sources);
ut_ad(srv_fast_shutdown);
ut_d(trx->in_rollback = false);
@@ -160,9 +160,6 @@ trx_rollback_to_savepoint_low(
mem_heap_free(heap);
- /* There might be work for utility threads.*/
- srv_active_wake_master_thread();
-
MONITOR_DEC(MONITOR_TRX_ACTIVE);
}
@@ -800,7 +797,8 @@ void trx_rollback_recovered(bool all)
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_d(trx_mutex_exit(trx));
- if (!srv_is_being_started && !srv_undo_sources && srv_fast_shutdown)
+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE && !srv_undo_sources &&
+ srv_fast_shutdown)
goto discard;
if (all || trx_get_dict_operation(trx) != TRX_DICT_OP_NONE)
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 7da5b2bc738..d63d7db4e32 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1485,11 +1485,6 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
must_flush_log_later= true;
else if (srv_flush_log_at_trx_commit)
trx_flush_log_if_needed(commit_lsn, this);
-
- /* Tell server some activity has happened, since the trx does
- changes something. Background utility threads like master thread,
- purge thread or page_cleaner thread might have some work to do. */
- srv_active_wake_master_thread();
}
ut_ad(!rsegs.m_noredo.undo);