summaryrefslogtreecommitdiff
path: root/storage/innobase/srv
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael.ronstrom@oracle.com>2011-05-04 11:08:07 +0200
committerMikael Ronstrom <mikael.ronstrom@oracle.com>2011-05-04 11:08:07 +0200
commitb444c4f2d3e1020a5469f12e5ae460be85925c10 (patch)
tree1d793c1b656afcb9c915a1ee3bf5ec796c2fcf78 /storage/innobase/srv
parenta24ba2276261d48f8a2e46342c7cdb1ee18a8be3 (diff)
parent0e647bc72d5e261e11245bf512e5ea37245ea90f (diff)
downloadmariadb-git-b444c4f2d3e1020a5469f12e5ae460be85925c10.tar.gz
merge
Diffstat (limited to 'storage/innobase/srv')
-rw-r--r--storage/innobase/srv/srv0srv.c85
-rw-r--r--storage/innobase/srv/srv0start.c23
2 files changed, 47 insertions, 61 deletions
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index dcf22656ad8..04503d25cd4 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -86,12 +86,6 @@ Created 10/8/1995 Heikki Tuuri
#include "mysql/plugin.h"
#include "mysql/service_thd_wait.h"
-/* This is set to the MySQL server value for this variable. It is only
-needed for FOREIGN KEY definition parsing since FOREIGN KEY names are not
-stored in the server metadata. The server stores and enforces it for
-regular database and table names.*/
-UNIV_INTERN uint srv_lower_case_table_names = 0;
-
/* The following counter is incremented whenever there is some user activity
in the server */
UNIV_INTERN ulint srv_activity_count = 0;
@@ -687,8 +681,6 @@ Unix.*/
/* Thread slot in the thread table */
struct srv_slot_struct{
- os_thread_id_t id; /*!< thread id */
- os_thread_t handle; /*!< thread handle */
unsigned type:1; /*!< thread type: user, utility etc. */
unsigned in_use:1; /*!< TRUE if this slot is in use */
unsigned suspended:1; /*!< TRUE if the thread is waiting
@@ -887,8 +879,6 @@ srv_table_reserve_slot(
slot->suspended = FALSE;
slot->type = type;
ut_ad(srv_slot_get_type(slot) == type);
- slot->id = os_thread_get_curr_id();
- slot->handle = os_thread_get_curr();
return(slot);
}
@@ -907,7 +897,6 @@ srv_suspend_thread(
ut_ad(mutex_own(&kernel_mutex));
ut_ad(slot->in_use);
ut_ad(!slot->suspended);
- ut_ad(slot->id == os_thread_get_curr_id());
if (srv_print_thread_releases) {
fprintf(stderr,
@@ -962,10 +951,9 @@ srv_release_threads(
if (srv_print_thread_releases) {
fprintf(stderr,
- "Releasing thread %lu type %lu"
+ "Releasing thread type %lu"
" from slot %lu\n",
- (ulong) slot->id, (ulong) type,
- (ulong) i);
+ (ulong) type, (ulong) i);
}
count++;
@@ -1149,6 +1137,10 @@ srv_conc_enter_innodb(
srv_conc_slot_t* slot = NULL;
ulint i;
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
@@ -1272,6 +1264,10 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
+ ut_ad(!trx->has_search_latch);
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
trx->op_info = "waiting in InnoDB queue";
thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
@@ -1307,6 +1303,10 @@ srv_conc_force_enter_innodb(
trx_t* trx) /*!< in: transaction object associated with the
thread */
{
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (UNIV_LIKELY(!srv_thread_concurrency)) {
return;
@@ -1378,6 +1378,10 @@ srv_conc_force_exit_innodb(
if (slot != NULL) {
os_event_set(slot->event);
}
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
}
/*********************************************************************//**
@@ -1389,6 +1393,10 @@ srv_conc_exit_innodb(
trx_t* trx) /*!< in: transaction object associated with the
thread */
{
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (trx->n_tickets_to_enter_innodb > 0) {
/* We will pretend the thread is still inside InnoDB though it
now leaves the InnoDB engine. In this way we save
@@ -1505,10 +1513,9 @@ srv_table_reserve_slot_for_mysql(void)
slot = srv_mysql_table + i;
fprintf(stderr,
- "Slot %lu: thread id %lu, type %lu,"
+ "Slot %lu: thread type %lu,"
" in use %lu, susp %lu, time %lu\n",
(ulong) i,
- (ulong) os_thread_pf(slot->id),
(ulong) slot->type,
(ulong) slot->in_use,
(ulong) slot->suspended,
@@ -1525,8 +1532,6 @@ srv_table_reserve_slot_for_mysql(void)
ut_a(slot->in_use == FALSE);
slot->in_use = TRUE;
- slot->id = os_thread_get_curr_id();
- slot->handle = os_thread_get_curr();
return(slot);
}
@@ -1613,17 +1618,6 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- if (trx->declared_to_be_inside_innodb) {
-
- was_declared_inside_innodb = TRUE;
-
- /* We must declare this OS thread to exit InnoDB, since a
- possible other thread holding a lock which this thread waits
- for must be allowed to enter, sooner or later */
-
- srv_conc_force_exit_innodb(trx);
- }
-
had_dict_lock = trx->dict_operation_lock_mode;
switch (had_dict_lock) {
@@ -1651,12 +1645,34 @@ srv_suspend_mysql_thread(
ut_a(trx->dict_operation_lock_mode == 0);
+ if (trx->declared_to_be_inside_innodb) {
+
+ was_declared_inside_innodb = TRUE;
+
+ /* We must declare this OS thread to exit InnoDB, since a
+ possible other thread holding a lock which this thread waits
+ for must be allowed to enter, sooner or later */
+
+ srv_conc_force_exit_innodb(trx);
+ }
+
/* Suspend this thread and wait for the event. */
thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_LOCK);
os_event_wait(event);
thd_wait_end(trx->mysql_thd);
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
+ if (was_declared_inside_innodb) {
+
+ /* Return back inside InnoDB */
+
+ srv_conc_force_enter_innodb(trx);
+ }
+
/* After resuming, reacquire the data dictionary latch if
necessary. */
@@ -1672,13 +1688,6 @@ srv_suspend_mysql_thread(
break;
}
- if (was_declared_inside_innodb) {
-
- /* Return back inside InnoDB */
-
- srv_conc_force_enter_innodb(trx);
- }
-
mutex_enter(&kernel_mutex);
/* Release the slot for others to use */
@@ -3067,11 +3076,7 @@ suspend_thread:
os_event_wait(slot->event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
- /* This is only extra safety, the thread should exit
- already when the event wait ends */
-
os_thread_exit(NULL);
-
}
/* When there is user activity, InnoDB will set the event and the
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 79eae610a05..cf11e75b8e0 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -2097,17 +2097,6 @@ innobase_shutdown_for_mysql(void)
The step 1 is the real InnoDB shutdown. The remaining steps 2 - ...
just free data structures after the shutdown. */
-
- if (srv_fast_shutdown == 2) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: MySQL has requested a very fast shutdown"
- " without flushing "
- "the InnoDB buffer pool to data files."
- " At the next mysqld startup "
- "InnoDB will do a crash recovery!\n");
- }
-
logs_empty_and_mark_files_at_shutdown();
if (srv_conc_n_threads != 0) {
@@ -2122,17 +2111,9 @@ innobase_shutdown_for_mysql(void)
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
- /* In a 'very fast' shutdown, we do not need to wait for these threads
- to die; all which counts is that we flushed the log; a 'very fast'
- shutdown is essentially a crash. */
-
- if (srv_fast_shutdown == 2) {
- return(DB_SUCCESS);
- }
-
/* All threads end up waiting for certain events. Put those events
- to the signaled state. Then the threads will exit themselves in
- os_thread_event_wait(). */
+ to the signaled state. Then the threads will exit themselves after
+ os_event_wait(). */
for (i = 0; i < 1000; i++) {
/* NOTE: IF YOU CREATE THREADS IN INNODB, YOU MUST EXIT THEM