List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:April 27 2010 9:13pm
Subject:bzr push into mysql-trunk-innodb branch (Sunny.Bains:3041 to 3042)
View as plain text  
 3042 Sunny Bains	2010-04-28
      Fix bug introduced by r3038. When a transaction is rolled back by the
      lock monitor thread, it may have locks that are granted to waited to
      waiting transactions. These waiting transactions will need to be woken
      up but their trx->lock_wait_timeout flag will be FALSE causing the old
      code to break. What we need is a flag that covers the entire lock
      release process not individual transactions. The fix is to move the
      flag out of trx_t and into srv_sys_t.

    modified:
      storage/innobase/include/trx0trx.h
      storage/innobase/srv/srv0srv.c
      storage/innobase/trx/trx0trx.c
 3041 Inaam Rana	2010-04-26
      buf_flush_list() should return failure if one of the buffer pool
      was skipped because another flush batch was active. This is to
      ensure that the when we return success then it is guaranteed that
      all pages up to the lsn_limit have been flushed to the disk.

    modified:
      storage/innobase/buf/buf0flu.c
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h	2010-04-23 05:19:17 +0000
+++ b/storage/innobase/include/trx0trx.h	2010-04-27 20:47:47 +0000
@@ -647,16 +647,6 @@ struct trx_struct{
 					TRX_QUE_LOCK_WAIT, this points to
 					the lock request, otherwise this is
 					NULL */
-	ibool		lock_wait_timeout;
-					/* when this transaction is rolled
-					back because the lock wait timed out.
-					We use this flag to distinguish between
-					a wait time out detected by the lock
-				       	monitor thread vs other code paths. For
-					the former we already have the the
-					srv_sys->mutex locked. For the other
-					cases we need to acquire it explicitly
-					when releasing a suspended thread. */
 	ibool		was_chosen_as_deadlock_victim;
 					/* when the transaction decides to wait
 					for a lock, it sets this to FALSE;

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2010-04-23 07:52:09 +0000
+++ b/storage/innobase/srv/srv0srv.c	2010-04-27 20:47:47 +0000
@@ -720,6 +720,14 @@ struct srv_sys_struct{
 						in the waiting_threads array */
 	ulint		activity_count;		/*!< For tracking server
 						activity */
+	unsigned	lock_wait_timeout;	/*!< TRUE if the lock monitor
+						thread is rolling back a
+					       	transaction that has waited
+					       	for too long for the lock a
+						be granted. We use this flag
+					       	to track whether the
+					       	srv_sys->mutex needs to be
+					       	acquired or not */
 };
 
 UNIV_INTERN os_event_t	srv_lock_timeout_thread_event;
@@ -1773,7 +1781,7 @@ srv_release_mysql_thread_if_suspended(
 {
 	ut_ad(mutex_own(&kernel_mutex));
 
-	if (!thr_get_trx(thr)->lock_wait_timeout) {
+	if (!srv_sys->lock_wait_timeout) {
 		srv_sys_mutex_enter();
 	} else {
 		ut_ad(srv_sys_mutex_own());
@@ -1784,7 +1792,7 @@ srv_release_mysql_thread_if_suspended(
 		os_event_set(thr->slot->event);
 	}
 
-	if (!thr_get_trx(thr)->lock_wait_timeout) {
+	if (!srv_sys->lock_wait_timeout) {
 		srv_sys_mutex_exit();
 	}
 }
@@ -2327,13 +2335,14 @@ srv_lock_check_wait(
 			    && ut_dulint_cmp(trx->id, slot_trx->id) == 0
 			    && trx->wait_lock != NULL) {
 
+				ut_a(!srv_sys->lock_wait_timeout);
 				ut_a(trx->que_state == TRX_QUE_LOCK_WAIT);
 
-				trx->lock_wait_timeout = TRUE;
+				srv_sys->lock_wait_timeout = TRUE;
 
 				lock_cancel_waiting_and_release(trx->wait_lock);
 
-				trx->lock_wait_timeout = FALSE;
+				srv_sys->lock_wait_timeout = FALSE;
 			}
 
 			mutex_exit(&kernel_mutex);

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	2010-04-23 05:19:17 +0000
+++ b/storage/innobase/trx/trx0trx.c	2010-04-27 20:47:47 +0000
@@ -189,8 +189,6 @@ trx_create(
 	trx->autoinc_locks = ib_vector_create(
 		mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 4), 4);
 
-	trx->lock_wait_timeout = FALSE;
-
 	return(trx);
 }
 


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20100427204747-ztbx98k0n7euxlrt.bundle
Thread
bzr push into mysql-trunk-innodb branch (Sunny.Bains:3041 to 3042) Sunny Bains27 Apr