List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 12 2011 8:08am
Subject:bzr push into mysql-trunk-innodb branch (marko.makela:3574 to 3576)
View as plain text  
 3576 Marko Mäkelä	2011-04-12
      trx_undo_free_prepared(): Fix a UNIV_SYNC_DEBUG assertion failure.
      Because the code is executed when no other InnoDB threads are
      running, it is not necessary to acquire any mutex.

    modified:
      storage/innobase/trx/trx0undo.c
 3575 Marko Mäkelä	2011-04-12 [merge]
      Merge mysql-5.5-innodb to mysql-trunk-innodb.

    modified:
      storage/innobase/lock/lock0wait.c
      storage/innobase/que/que0que.c
 3574 Sunny Bains	2011-04-12
      Bug 12348462 - ALLOW MULTIPLE SYNC WAIT ARRAYS
      
      Once threads start to queue on any InnoDB mutex/rw_lock the single OS mutex
      in the single sync wait array instance becomes a big bottleneck.
      
      New config variable:
         --innodb-sync-array-size : default is 32 max is 1024.
      
      We loop over all the arrays only when we need to print out diagnostic
      information or when we need to handle lost wakeup.
      
      This is an interim solution until we get rid of the sync0arr.c code completely.
      
      rb://635 Approved by Marko

    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/srv0srv.h
      storage/innobase/include/sync0arr.h
      storage/innobase/include/sync0arr.ic
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/sync0sync.h
      storage/innobase/sync/sync0arr.c
      storage/innobase/sync/sync0rw.c
      storage/innobase/sync/sync0sync.c
=== modified file 'storage/innobase/lock/lock0wait.c'
--- a/storage/innobase/lock/lock0wait.c	revid:sunny.bains@stripped2012137-fqao8q5x283ub8f6
+++ b/storage/innobase/lock/lock0wait.c	revid:marko.makela@strippedwjnxoe8yveod
@@ -209,7 +209,7 @@ lock_wait_suspend_thread(
 	double		wait_time;
 	trx_t*		trx;
 	ulint		had_dict_lock;
-	ibool		was_declared_inside_innodb	= FALSE;
+	ibool		was_declared_inside_innodb;
 	ib_int64_t	start_time			= 0;
 	ib_int64_t	finish_time;
 	ulint		sec;
@@ -270,17 +270,6 @@ lock_wait_suspend_thread(
 	lock_wait_mutex_exit();
 	trx_mutex_exit(trx);
 
-	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) {
@@ -304,17 +293,21 @@ lock_wait_suspend_thread(
 
 	/* Suspend this thread and wait for the event. */
 
-	ut_ad(!trx_mutex_own(trx));
+	was_declared_inside_innodb = trx->declared_to_be_inside_innodb;
+
+	if (was_declared_inside_innodb) {
+		/* 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);
+	}
+
 	os_event_wait(slot->event);
 
 	/* After resuming, reacquire the data dictionary latch if
 	necessary. */
 
-	if (had_dict_lock) {
-
-		row_mysql_freeze_data_dictionary(trx);
-	}
-
 	if (was_declared_inside_innodb) {
 
 		/* Return back inside InnoDB */
@@ -322,6 +315,11 @@ lock_wait_suspend_thread(
 		srv_conc_force_enter_innodb(trx);
 	}
 
+	if (had_dict_lock) {
+
+		row_mysql_freeze_data_dictionary(trx);
+	}
+
 	wait_time = ut_difftime(ut_time(), slot->suspend_time);
 
 	/* Release the slot for others to use */

=== modified file 'storage/innobase/que/que0que.c'
--- a/storage/innobase/que/que0que.c	revid:sunny.bains@stripped8f6
+++ b/storage/innobase/que/que0que.c	revid:marko.makela@stripped
@@ -1216,9 +1216,6 @@ loop:
 		goto loop;
 
 	case QUE_THR_LOCK_WAIT:
-		/* The ..._mysql_... function works also for InnoDB's
-		internal threads. Let us wait that the lock wait ends. */
-
 		lock_wait_suspend_thread(thr);
 
 		trx_mutex_enter(thr_get_trx(thr));

=== modified file 'storage/innobase/trx/trx0undo.c'
--- a/storage/innobase/trx/trx0undo.c	revid:sunny.bains@strippedub8f6
+++ b/storage/innobase/trx/trx0undo.c	revid:marko.makela@stripped
@@ -1993,8 +1993,6 @@ trx_undo_free_prepared(
 /*===================*/
 	trx_t*	trx)	/*!< in/out: PREPARED transaction */
 {
-	mutex_enter(&trx->rseg->mutex);
-
 	ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
 
 	if (trx->update_undo) {
@@ -2009,6 +2007,5 @@ trx_undo_free_prepared(
 			       trx->insert_undo);
 		trx_undo_mem_free(trx->insert_undo);
 	}
-	mutex_exit(&trx->rseg->mutex);
 }
 #endif /* !UNIV_HOTBACKUP */

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20110412080743-8s5lwjnxoe8yveod.bundle
Thread
bzr push into mysql-trunk-innodb branch (marko.makela:3574 to 3576) marko.makela12 Apr