List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:June 10 2010 3:14am
Subject:bzr commit into mysql-5.6-innodb branch (Sunny.Bains:3137)
View as plain text  
#At file:///Users/sunny/innodb/bzr-new/5.6/ based on revid:sunny.bains@stripped

 3137 Sunny Bains	2010-06-10
      Recommit the bug fixes and other changes unrelated to the kernel mutex
      and MT-Purge changes.

    modified:
      storage/innobase/include/que0que.h
      storage/innobase/lock/lock0lock.c
      storage/innobase/que/que0que.c
      storage/innobase/trx/trx0roll.c
      storage/innobase/trx/trx0trx.c
=== modified file 'storage/innobase/include/que0que.h'
--- a/storage/innobase/include/que0que.h	revid:sunny.bains@stripped
+++ b/storage/innobase/include/que0que.h	revid:sunny.bains@stripped
@@ -156,14 +156,14 @@ que_run_threads(
 Moves a suspended query thread to the QUE_THR_RUNNING state and release
 a 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. */
+completion.
+@return query thread instance of thread to wakeup or NULL  */
 UNIV_INTERN
-void
-que_thr_end_wait(
-/*=============*/
+que_thr_t*
+que_thr_end_lock_wait(
+/*==================*/
 	trx_t*		trx);		/*!< in: transaction in the
-					QUE_THR_LOCK_WAIT, or
-				       	QUE_THR_PROCEDURE_WAIT, state */
+					QUE_THR_LOCK_WAIT state */
 /**********************************************************************//**
 Starts execution of a command in a query fork. Picks a query thread which
 is not in the QUE_THR_RUNNING state and moves it to that state. If none

=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	revid:sunny.bains@stripped
+++ b/storage/innobase/lock/lock0lock.c	revid:sunny.bains@stripped
@@ -2207,7 +2207,7 @@ lock_grant(
 	for it */
 
 	if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
-		que_thr_end_wait(lock->trx);
+		que_thr_end_lock_wait(lock->trx);
 	}
 
 	trx_mutex_exit(lock->trx);
@@ -2237,7 +2237,7 @@ lock_rec_cancel(
 
 	/* The following function releases the trx from lock wait */
 
-	que_thr_end_wait(lock->trx);
+	que_thr_end_lock_wait(lock->trx);
 
 	trx_mutex_exit(lock->trx);
 }
@@ -3378,48 +3378,48 @@ lock_choose_trx_for_rollback(
 	point: a deadlock detected; or we have
 	searched the waits-for graph too long */
 
-	//FILE*	ef = lock_latest_err_file;
+	FILE*	ef = lock_latest_err_file;
 
-	//rewind(ef);
-	//ut_print_timestamp(ef);
+	rewind(ef);
+	ut_print_timestamp(ef);
 
-	//trx_mutex_enter(wait_lock->trx);
+	trx_mutex_enter(wait_lock->trx);
 
-	//fputs("\n*** (1) TRANSACTION:\n", ef);
+	fputs("\n*** (1) TRANSACTION:\n", ef);
 
-	//trx_print(ef, wait_lock->trx, 3000);
+	trx_print(ef, wait_lock->trx, 3000);
 
-	//fputs("*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
+	fputs("*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
 
-	//if (lock_get_type_low(wait_lock) == LOCK_REC) {
-		//lock_rec_print(ef, wait_lock);
-	//} else {
-		//lock_table_print(ef, wait_lock);
-	//}
+	if (lock_get_type_low(wait_lock) == LOCK_REC) {
+		lock_rec_print(ef, wait_lock);
+	} else {
+		lock_table_print(ef, wait_lock);
+	}
 
-	//fputs("*** (2) TRANSACTION:\n", ef);
+	fputs("*** (2) TRANSACTION:\n", ef);
 
-	//trx_print(ef, lock->trx, 3000);
+	trx_print(ef, lock->trx, 3000);
 
-	//fputs("*** (2) HOLDS THE LOCK(S):\n", ef);
+	fputs("*** (2) HOLDS THE LOCK(S):\n", ef);
 
-	//if (lock_get_type_low(lock) == LOCK_REC) {
-		//lock_rec_print(ef, lock);
-	//} else {
-		//lock_table_print(ef, lock);
-	//}
+	if (lock_get_type_low(lock) == LOCK_REC) {
+		lock_rec_print(ef, lock);
+	} else {
+		lock_table_print(ef, lock);
+	}
 
-	//fputs("*** (2) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
+	fputs("*** (2) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
 
-	//if (lock_get_type_low(start->lock.wait_lock) == LOCK_REC) {
-		//lock_rec_print(ef, start->lock.wait_lock);
-	//} else {
-		//lock_table_print(ef, start->lock.wait_lock);
-	//}
+	if (lock_get_type_low(start->lock.wait_lock) == LOCK_REC) {
+		lock_rec_print(ef, start->lock.wait_lock);
+	} else {
+		lock_table_print(ef, start->lock.wait_lock);
+	}
 #ifdef UNIV_DEBUG
-	//if (lock_print_waits) {
-		//fputs("Deadlock detected\n", stderr);
-	//}
+	if (lock_print_waits) {
+		fputs("Deadlock detected\n", stderr);
+	}
 #endif /* UNIV_DEBUG */
 
 	if (trx_weight_cmp(wait_lock->trx, start) >= 0) {
@@ -3437,7 +3437,7 @@ lock_choose_trx_for_rollback(
 	as a victim to try to avoid deadlocking our
 	recursion starting point transaction */
 
-	//fputs("*** WE ROLL BACK TRANSACTION (1)\n", ef);
+	fputs("*** WE ROLL BACK TRANSACTION (1)\n", ef);
 
 	wait_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE;
 
@@ -3563,14 +3563,8 @@ lock_deadlock_recursive(
 				return(LOCK_VICTIM_EXCEED_MAX_DEPTH);
 			}
 
-			/* The transaction's que_state can't change since
-			we hold the lock mutex. FIXME: Confirm. */
-			//trx_mutex_enter(lock_trx);
-
 			if (lock_trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
 
-				//trx_mutex_exit(lock_trx);
-
 				/* Another trx ahead has requested lock	in an
 				incompatible mode, and is itself waiting for
 				a lock */
@@ -3585,7 +3579,6 @@ lock_deadlock_recursive(
 					return(ret);
 				}
 			}
-			//trx_mutex_exit(lock_trx);
 		}
 		/* Get the next record lock to check. */
 		if (heap_no != ULINT_UNDEFINED) {
@@ -5799,5 +5792,5 @@ lock_cancel_waiting_and_release(
 
 	/* The following function releases the trx from lock wait. */
 
-	que_thr_end_wait(lock->trx);
+	que_thr_end_lock_wait(lock->trx);
 }

=== modified file 'storage/innobase/que/que0que.c'
--- a/storage/innobase/que/que0que.c	revid:sunny.bains@stripped
+++ b/storage/innobase/que/que0que.c	revid:sunny.bains@stripped
@@ -193,18 +193,19 @@ que_thr_create(
 Moves a suspended query thread to the QUE_THR_RUNNING state and may release
 a 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. */
+completion.
+@return the query thread that needs to be released. */
 UNIV_INTERN
-void
-que_thr_end_wait(
-/*=============*/
+que_thr_t*
+que_thr_end_lock_wait(
+/*==================*/
 	trx_t*		trx)	/*!< in: transaction with que_state in
-		       		QUE_THR_LOCK_WAIT, or QUE_THR_PROCEDURE_WAIT */
+		       		QUE_THR_LOCK_WAIT */
 {
 	que_thr_t*	thr;
 	ibool		was_active;
 
-	ut_ad(trx_mutex_own(trx));
+	ut_ad(lock_mutex_own());
 
 	thr = trx->lock.wait_thr;
 
@@ -214,8 +215,7 @@ que_thr_end_wait(
 	/* In MySQL this is the only possible state here */
 	ut_a(thr->state == QUE_THR_LOCK_WAIT);
 
-	ut_ad(thr->state == QUE_THR_LOCK_WAIT
-	      || thr->state == QUE_THR_PROCEDURE_WAIT);
+	ut_ad(thr->state == QUE_THR_LOCK_WAIT);
 
 	was_active = thr->is_active;
 
@@ -228,9 +228,7 @@ que_thr_end_wait(
 	/* In MySQL we let the OS thread (not just the query thread) to wait
 	for the lock to be released: */
 
-	if (!was_active && thr != NULL) {
-		lock_wait_release_thread_if_suspended(thr);
-	}
+	return((!was_active && thr != NULL) ? thr : NULL);
 }
 
 /**********************************************************************//**

=== modified file 'storage/innobase/trx/trx0roll.c'
--- a/storage/innobase/trx/trx0roll.c	revid:sunny.bains@stripped
+++ b/storage/innobase/trx/trx0roll.c	revid:sunny.bains@stripped
@@ -107,8 +107,6 @@ trx_general_rollback_for_mysql_low(
 
 		trx_finish_rollback(trx);
 
-		mem_heap_free(heap);
-
 		trx_mutex_enter(trx);
 
 		ut_a(trx->lock.que_state == TRX_QUE_RUNNING);
@@ -117,6 +115,8 @@ trx_general_rollback_for_mysql_low(
 
 		trx_mutex_exit(trx);
 	}
+
+	mem_heap_free(heap);
 }
 
 /*******************************************************************//**
@@ -528,11 +528,11 @@ trx_rollback_active(
 
 	que_run_threads(roll_node->undo_thr);
 
+	trx_finish_rollback(thr_get_trx(roll_node->undo_thr));
+
 	/* Free the memory reserved by the undo graph */
 	que_graph_free(roll_node->undo_thr->common.parent);
 
-	trx_finish_rollback(thr_get_trx(roll_node->undo_thr));
-
 	ut_a(trx->lock.que_state == TRX_QUE_RUNNING);
 
 	if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	revid:sunny.bains@stripped
+++ b/storage/innobase/trx/trx0trx.c	revid:sunny.bains@stripped
@@ -206,8 +206,6 @@ trx_free(
 /*=====*/
 	trx_t*	trx)	/*!< in, own: trx object */
 {
-	trx_mutex_enter(trx);
-
 	if (trx->declared_to_be_inside_innodb) {
 		ut_print_timestamp(stderr);
 		fputs("  InnoDB: Error: Freeing a trx which is declared"
@@ -238,6 +236,8 @@ trx_free(
 		putc('\n', stderr);
 	}
 
+	trx_mutex_enter(trx);
+
 	ut_a(trx->magic_n == TRX_MAGIC_N);
 
 	trx->magic_n = 11112222;


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20100610031402-fsxsoqo880gqxapb.bundle
Thread
bzr commit into mysql-5.6-innodb branch (Sunny.Bains:3137) Sunny Bains10 Jun