From 4fa5e50edbba856a2fe60d1dde7eb5571f42bd68 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Nov 2002 14:47:25 +0200 Subject: Many files: Fix hang introduced by selective deadlock resolution srv0srv.c, row0mysql.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/include/que0que.h: Fix hang introduced by selective deadlock resolution innobase/include/trx0trx.h: Fix hang introduced by selective deadlock resolution innobase/include/ut0ut.h: Fix hang introduced by selective deadlock resolution innobase/lock/lock0lock.c: Fix hang introduced by selective deadlock resolution innobase/log/log0log.c: Fix hang introduced by selective deadlock resolution innobase/que/que0que.c: Fix hang introduced by selective deadlock resolution innobase/row/row0mysql.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/srv/srv0srv.c: Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE innobase/trx/trx0sys.c: Fix hang introduced by selective deadlock resolution innobase/trx/trx0trx.c: Fix hang introduced by selective deadlock resolution --- innobase/include/que0que.h | 8 ++++++-- innobase/include/trx0trx.h | 11 ++++++++++- innobase/include/ut0ut.h | 1 - 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'innobase/include') diff --git a/innobase/include/que0que.h b/innobase/include/que0que.h index cdaeeae1fde..a3ed18e2b14 100644 --- a/innobase/include/que0que.h +++ b/innobase/include/que0que.h @@ -117,6 +117,7 @@ que_thr_stop( /************************************************************************** Moves a thread from another state to the QUE_THR_RUNNING state. Increments the n_active_thrs counters of the query graph and transaction. */ + void que_thr_move_to_run_state_for_mysql( /*================================*/ @@ -125,14 +126,17 @@ que_thr_move_to_run_state_for_mysql( /************************************************************************** A patch for MySQL used to 'stop' a dummy query thread used in MySQL select, when there is no error or lock wait. */ + void que_thr_stop_for_mysql_no_error( /*============================*/ que_thr_t* thr, /* in: query thread */ trx_t* trx); /* in: transaction */ /************************************************************************** -A patch for MySQL used to 'stop' a dummy query thread used in MySQL -select. */ +A patch for MySQL used to 'stop' a dummy query thread used in MySQL. The +query thread is stopped and made inactive, except in the case where +it was put to the lock wait state in lock0lock.c, but the lock has already +been granted or the transaction chosen as a victim in deadlock resolution. */ void que_thr_stop_for_mysql( diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 1468ef449e7..34f820f03e7 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -429,7 +429,10 @@ struct trx_struct{ MySQL */ /*------------------------------*/ ulint error_state; /* 0 if no error, otherwise error - number */ + number; NOTE That ONLY the thread + doing the transaction is allowed to + set this field: this is NOT protected + by the kernel mutex */ void* error_info; /* if the error number indicates a duplicate key error, a pointer to the problematic index is stored here */ @@ -466,6 +469,12 @@ struct trx_struct{ TRX_QUE_LOCK_WAIT, this points to the lock request, otherwise this is NULL */ + ibool was_chosen_as_deadlock_victim; + /* when the transaction decides to wait + for a lock, this it sets this to FALSE; + if another transaction chooses this + transaction as a victim in deadlock + resolution, it sets this to TRUE */ time_t wait_started; /* lock wait started at this time */ UT_LIST_BASE_NODE_T(que_thr_t) wait_thrs; /* query threads belonging to this diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h index d4697c47266..8ec23b23dcd 100644 --- a/innobase/include/ut0ut.h +++ b/innobase/include/ut0ut.h @@ -10,7 +10,6 @@ Created 1/20/1994 Heikki Tuuri #define ut0ut_h #include "univ.i" -#include #include #ifndef MYSQL_SERVER #include -- cgit v1.2.1