summaryrefslogtreecommitdiff
path: root/innobase/que/que0que.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-25 22:54:00 +0300
committerunknown <monty@mysql.com>2004-05-25 22:54:00 +0300
commita9b481d3cd7fbf832b17523c521185db6366492c (patch)
treeb258dbd41e0b45f70adf8c42ee94cce74cd0232f /innobase/que/que0que.c
parentde5edbf8db66e1f896b76d408152cd0094dcf684 (diff)
parenta3d0ce6bc611673e2d5342bc9cd735a9febfe6b4 (diff)
downloadmariadb-git-a9b481d3cd7fbf832b17523c521185db6366492c.tar.gz
merge with 4.0 to get Netware patches and fixes for libmysqld.dll
configure.in: Auto merged Build-tools/Do-compile: Auto merged client/mysql.cc: Auto merged client/mysqladmin.c: Auto merged client/mysqlcheck.c: Auto merged client/mysqldump.c: Auto merged client/mysqlimport.c: Auto merged client/mysqlshow.c: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/thr_alarm.h: Auto merged innobase/include/trx0roll.h: Auto merged innobase/include/trx0trx.h: Auto merged innobase/que/que0que.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/usr/usr0sess.c: Auto merged isam/isamchk.c: Auto merged myisam/myisam_ftdump.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisampack.c: Auto merged mysys/default.c: Auto merged mysys/my_getopt.c: Auto merged mysys/my_init.c: Auto merged mysys/my_pthread.c: Auto merged netware/Makefile.am: Auto merged netware/init_db.sql: Auto merged scripts/make_binary_distribution.sh: Auto merged tools/mysqlmanager.c: Auto merged VC++Files/dbug/dbug.dsp: Auto merged VC++Files/heap/heap.dsp: Auto merged VC++Files/isam/isam.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged VC++Files/myisam/myisam.dsp: Auto merged VC++Files/myisammrg/myisammrg.dsp: Auto merged VC++Files/mysys/mysys.dsp: Auto merged VC++Files/libmysqld/libmysqld.dsp: merge client/mysqlbinlog.cc: merge extra/perror.c: merge include/mysql_com.h: merge libmysqld/Makefile.am: merge netware/BUILD/mwenv: merge sql/mysqld.cc: merge
Diffstat (limited to 'innobase/que/que0que.c')
-rw-r--r--innobase/que/que0que.c109
1 files changed, 22 insertions, 87 deletions
diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c
index b2608b6d175..08bf7ce3e59 100644
--- a/innobase/que/que0que.c
+++ b/innobase/que/que0que.c
@@ -12,7 +12,6 @@ Created 5/27/1996 Heikki Tuuri
#include "que0que.ic"
#endif
-#include "srv0que.h"
#include "usr0sess.h"
#include "trx0trx.h"
#include "trx0roll.h"
@@ -175,19 +174,15 @@ a single worker thread to execute it. This function should be used to end
the wait state of a query thread waiting for a lock or a stored procedure
completion. */
-void
+que_thr_t*
que_thr_end_wait(
/*=============*/
- que_thr_t* thr, /* in: query thread in the
+ /* out: next query thread to run;
+ NULL if none */
+ que_thr_t* thr) /* in: query thread in the
QUE_THR_LOCK_WAIT,
or QUE_THR_PROCEDURE_WAIT, or
QUE_THR_SIG_REPLY_WAIT state */
- que_thr_t** next_thr) /* in/out: next query thread to run;
- if the value which is passed in is
- a pointer to a NULL pointer, then the
- calling function can start running
- a new query thread; if NULL is passed
- as the parameter, it is ignored */
{
ibool was_active;
@@ -195,6 +190,8 @@ que_thr_end_wait(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
+ ut_ad(next_thr);
+ ut_ad(*next_thr == NULL);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|| (thr->state == QUE_THR_SIG_REPLY_WAIT));
@@ -206,17 +203,8 @@ que_thr_end_wait(
que_thr_move_to_run_state(thr);
- if (was_active) {
-
- return;
- }
-
- if (next_thr && *next_thr == NULL) {
- *next_thr = thr;
- } else {
- srv_que_task_enqueue_low(thr);
- }
-}
+ return(was_active ? NULL : thr);
+}
/**************************************************************************
Same as que_thr_end_wait, but no parameter next_thr available. */
@@ -253,8 +241,6 @@ que_thr_end_wait_no_next_thr(
for the lock to be released: */
srv_release_mysql_thread_if_suspended(thr);
-
- /* srv_que_task_enqueue_low(thr); */
}
/**************************************************************************
@@ -355,48 +341,6 @@ que_fork_start_command(
return(NULL);
}
-/**************************************************************************
-After signal handling is finished, returns control to a query graph error
-handling routine. (Currently, just returns the control to the root of the
-graph so that the graph can communicate an error message to the client.) */
-
-void
-que_fork_error_handle(
-/*==================*/
- trx_t* trx __attribute__((unused)), /* in: trx */
- que_t* fork) /* in: query graph which was run before signal
- handling started, NULL not allowed */
-{
- que_thr_t* thr;
-
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
- ut_ad(trx->sess->state == SESS_ERROR);
- ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
- ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
-
- thr = UT_LIST_GET_FIRST(fork->thrs);
-
- while (thr != NULL) {
- ut_ad(!thr->is_active);
- ut_ad(thr->state != QUE_THR_SIG_REPLY_WAIT);
- ut_ad(thr->state != QUE_THR_LOCK_WAIT);
-
- thr->run_node = thr;
- thr->prev_node = thr->child;
- thr->state = QUE_THR_COMPLETED;
-
- thr = UT_LIST_GET_NEXT(thrs, thr);
- }
-
- thr = UT_LIST_GET_FIRST(fork->thrs);
-
- que_thr_move_to_run_state(thr);
-
- srv_que_task_enqueue_low(thr);
-}
-
/********************************************************************
Tests if all the query threads in the same fork have a given state. */
UNIV_INLINE
@@ -765,22 +709,18 @@ this function may only be called from inside que_run_threads or
que_thr_check_if_switch! These restrictions exist to make the rollback code
easier to maintain. */
static
-void
+que_thr_t*
que_thr_dec_refer_count(
/*====================*/
- que_thr_t* thr, /* in: query thread */
- que_thr_t** next_thr) /* in/out: next query thread to run;
- if the value which is passed in is
- a pointer to a NULL pointer, then the
- calling function can start running
- a new query thread */
+ /* out: next query thread to run */
+ que_thr_t* thr) /* in: query thread */
{
que_fork_t* fork;
trx_t* trx;
sess_t* sess;
ulint fork_type;
- ibool stopped;
-
+ que_thr_t* next_thr = NULL;
+
fork = thr->common.parent;
trx = thr->graph->trx;
sess = trx->sess;
@@ -791,9 +731,7 @@ que_thr_dec_refer_count(
if (thr->state == QUE_THR_RUNNING) {
- stopped = que_thr_stop(thr);
-
- if (!stopped) {
+ if (!que_thr_stop(thr)) {
/* The reason for the thr suspension or wait was
already canceled before we came here: continue
running the thread */
@@ -801,15 +739,9 @@ que_thr_dec_refer_count(
/* fputs("!!!!!!!! Wait already ended: continue thr\n",
stderr); */
- if (next_thr && *next_thr == NULL) {
- *next_thr = thr;
- } else {
- srv_que_task_enqueue_low(thr);
- }
-
mutex_exit(&kernel_mutex);
- return;
+ return(thr);
}
}
@@ -825,7 +757,7 @@ que_thr_dec_refer_count(
mutex_exit(&kernel_mutex);
- return;
+ return(next_thr);
}
fork_type = fork->fork_type;
@@ -841,7 +773,7 @@ que_thr_dec_refer_count(
ut_ad(UT_LIST_GET_LEN(trx->signals) > 0);
ut_ad(trx->handling_signals == TRUE);
- trx_finish_rollback_off_kernel(fork, trx, next_thr);
+ next_thr = trx_finish_rollback_off_kernel(fork, trx);
} else if (fork_type == QUE_FORK_PURGE) {
@@ -863,7 +795,7 @@ que_thr_dec_refer_count(
zero, then we start processing a signal; from it we may get
a new query thread to run */
- trx_sig_start_handle(trx, next_thr);
+ next_thr = trx_sig_start_handle(trx);
}
if (trx->handling_signals && UT_LIST_GET_LEN(trx->signals) == 0) {
@@ -872,6 +804,8 @@ que_thr_dec_refer_count(
}
mutex_exit(&kernel_mutex);
+
+ return(next_thr);
}
/**************************************************************************
@@ -1245,6 +1179,7 @@ loop:
/*-------------------------*/
next_thr = que_thr_step(thr);
/*-------------------------*/
+ ut_a(next_thr == thr || next_thr == NULL);
/* Test the effect on performance of adding extra mutex
reservations */
@@ -1257,7 +1192,7 @@ loop:
loop_count++;
if (next_thr != thr) {
- que_thr_dec_refer_count(thr, &next_thr);
+ next_thr = que_thr_dec_refer_count(thr);
if (next_thr == NULL) {