List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:February 10 2011 2:15am
Subject:bzr push into mysql-trunk-innodb branch (Sunny.Bains:3489 to 3490)
View as plain text  
 3490 Sunny Bains	2011-02-10
      Make trx_sys_t::latest_rseg static and local to trx_assign_rseg(). It was only
      being used in this function. There really is no need to protect this variable
      using an X trx_sys_t::lock. We don't care about overflow because all the work
      is done using an auto variable i in trx_assign_rseg() and doing a modulus on
      i ensures that we will not overflow the bounds of the rseg array.
      
      Reading/Incrementing latest_rseg doesn't need to atomic either. This change
      should help in further reducing the contention on the trx_sys_t::lock.
      
      rb://594 Approved by Jimmy Yang.

    modified:
      storage/innobase/include/trx0sys.h
      storage/innobase/trx/trx0trx.c
 3489 Jimmy Yang	2011-02-09 [merge]
      Merge from mysql-5.5-innodb to mysql-trunk-innodb

    modified:
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0load.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/handler/i_s.cc
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0load.h
      storage/innobase/include/dict0mem.h
      storage/innobase/include/dict0priv.ic
      storage/innobase/include/dict0types.h
      storage/innobase/row/row0merge.c
      storage/innobase/row/row0mysql.c
=== modified file 'storage/innobase/include/trx0sys.h'
--- a/storage/innobase/include/trx0sys.h	revid:jimmy.yang@stripped
+++ b/storage/innobase/include/trx0sys.h	revid:sunny.bains@stripped
@@ -685,9 +685,6 @@ struct trx_sys_struct{
 	UT_LIST_BASE_NODE_T(trx_t) mysql_trx_list;
 					/*!< List of transactions created
 					for MySQL */
-	ulint		latest_rseg;	/*!< Latest rollback segment in the
-					round-robin assignment of rollback
-					segments to transactions */
 	trx_rseg_t*	rseg_array[TRX_SYS_N_RSEGS];
 					/*!< Pointer array to rollback
 					segments; NULL if slot not in use;

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	revid:jimmy.yang@stripped
+++ b/storage/innobase/trx/trx0trx.c	revid:sunny.bains@stripped
@@ -595,7 +595,6 @@ trx_lists_init_at_db_start(void)
 
 /******************************************************************//**
 Assigns a rollback segment to a transaction in a round-robin fashion.
-Skips the SYSTEM rollback segment if another is available.
 @return	assigned rollback segment */
 UNIV_INLINE
 trx_rseg_t*
@@ -604,11 +603,12 @@ trx_assign_rseg(void)
 {
 	ulint		i;
 	trx_rseg_t*	rseg;
+	static ulint	latest_rseg = 0;
 
-	/* This breaks true round robin but that should be OK.
-	Our aim is to reduce the contention of the trx_sys_t::lock.  */
-	i = trx_sys->latest_rseg;
-	i %= TRX_SYS_N_RSEGS;
+	/* This breaks true round robin but that should be OK. */
+
+	i = latest_rseg++;
+        i %= TRX_SYS_N_RSEGS;
 
 	do {
 		rseg = trx_sys->rseg_array[i];
@@ -618,13 +618,13 @@ trx_assign_rseg(void)
 
 	} while (rseg == NULL);
 
+#ifdef UNIV_DEBUG
 	rw_lock_x_lock(&trx_sys->lock);
 
-	trx_sys->latest_rseg = i % TRX_SYS_N_RSEGS;
-
 	ut_ad(trx_sys_validate_trx_list());
 
 	rw_lock_x_unlock(&trx_sys->lock);
+#endif /* UNIV_DEBUG */
 
 	return(rseg);
 }


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20110210015607-n8v2qcfc957r0u9u.bundle
Thread
bzr push into mysql-trunk-innodb branch (Sunny.Bains:3489 to 3490) Sunny Bains10 Feb