List:Commits« Previous MessageNext Message »
From:marko.makela Date:November 21 2011 8:20am
Subject:bzr push into mysql-trunk branch (marko.makela:3635 to 3636) WL#6046
View as plain text  
 3636 Marko Mäkelä	2011-11-21
      Add some assertions and comments for WL#6046.

    modified:
      storage/innobase/include/trx0trx.h
      storage/innobase/include/trx0trx.ic
      storage/innobase/lock/lock0lock.c
      storage/innobase/read/read0read.c
      storage/innobase/row/row0vers.c
      storage/innobase/trx/trx0sys.c
      storage/innobase/trx/trx0trx.c
 3635 Sneha Modi	2011-11-21 [merge]
      Bug#11748572:
      
      Merging from mysql-5.5 -> mysql-trunk

    modified:
      mysql-test/collections/default.experimental
      mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc
      mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
      mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result
      mysql-test/suite/sys_vars/t/disabled.def
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h	revid:sneha.modi@strippedm-20111121053150-8j5utwnf4rqq0516
+++ b/storage/innobase/include/trx0trx.h	revid:marko.makela@stripped81955-7swepqssvrj8lfca
@@ -448,9 +448,19 @@ non-locking select */
 	ut_ad((t)->in_ro_trx_list == (t)->read_only);			\
 	ut_ad((t)->in_rw_trx_list == !(t)->read_only);			\
 	ut_ad(!trx_is_autocommit_non_locking((t)));			\
+	switch ((t)->state) {						\
+	case TRX_STATE_PREPARED:					\
+		ut_a(!(t)->read_only);					\
+		/* fall through */					\
+	case TRX_STATE_ACTIVE:						\
+	case TRX_STATE_COMMITTED_IN_MEMORY:				\
+		continue;						\
+	case TRX_STATE_NOT_STARTED:					\
+		break;							\
+	}								\
+	ut_error;							\
 } while (0)
 
-
 #ifdef UNIV_DEBUG
 /*******************************************************************//**
 Assert that an autocommit non-locking slect cannot be in the
@@ -459,11 +469,14 @@ The tranasction must be in the mysql_trx
 # define assert_trx_nonlocking_or_in_list(t)				\
 	do {								\
 		if (trx_is_autocommit_non_locking(t)) {			\
+			trx_state_t	t_state = (t)->state;		\
 			ut_ad((t)->read_only);				\
 			ut_ad(!(t)->is_recovered);			\
 			ut_ad(!(t)->in_ro_trx_list);			\
 			ut_ad(!(t)->in_rw_trx_list);			\
 			ut_ad((t)->in_mysql_trx_list);			\
+			ut_ad(t_state == TRX_STATE_NOT_STARTED		\
+			      || t_state == TRX_STATE_ACTIVE);		\
 		} else {						\
 			assert_trx_in_list(t);				\
 		}							\
@@ -639,7 +652,7 @@ struct trx_struct{
 	Recovered XA:
 	* NOT_STARTED -> PREPARED -> COMMITTED -> (freed)
 
-	Recovered XA (2PC) (shutdown before ROLLBACK or COMMIT):
+	XA (2PC) (shutdown before ROLLBACK or COMMIT):
 	* NOT_STARTED -> PREPARED -> (freed)
 
 	Latching and various transaction lists membership rules:

=== modified file 'storage/innobase/include/trx0trx.ic'
--- a/storage/innobase/include/trx0trx.ic	revid:sneha.modi@stripped0-8j5utwnf4rqq0516
+++ b/storage/innobase/include/trx0trx.ic	revid:marko.makela@strippedvrj8lfca
@@ -48,14 +48,8 @@ trx_state_eq(
 		return(trx->state == state);
 
 	case TRX_STATE_ACTIVE:
-		if (trx_is_autocommit_non_locking(trx)) {
-			ut_ad(!trx->is_recovered);
-			ut_ad(trx->read_only);
-			ut_ad(!trx->in_ro_trx_list);
-			ut_ad(!trx->in_rw_trx_list);
-			return(state == trx->state);
-		}
-		/* fall through for non-ac-nl-ro */
+		assert_trx_nonlocking_or_in_list(trx);
+		return(state == trx->state);
 
 	case TRX_STATE_COMMITTED_IN_MEMORY:
 		assert_trx_in_list(trx);

=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	revid:sneha.modi@stripped8j5utwnf4rqq0516
+++ b/storage/innobase/lock/lock0lock.c	revid:marko.makela@strippedlfca
@@ -5089,6 +5089,10 @@ lock_print_info_all_transactions(
 
 	/* First print info on non-active transactions */
 
+	/* NOTE: information of auto-commit non-locking read-only
+	transactions will be omitted here. The information will be
+	available from INFORMATION_SCHEMA.INNODB_TRX. */
+
 	for (trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
 	     trx != NULL;
 	     trx = UT_LIST_GET_NEXT(mysql_trx_list, trx)) {
@@ -5115,6 +5119,7 @@ loop:
 	     trx = UT_LIST_GET_NEXT(trx_list, trx), i++) {
 
 		assert_trx_in_list(trx);
+		ut_ad(trx->read_only == (trx_list == &trx_sys->ro_trx_list));
 	}
 
 	ut_ad(trx == NULL

=== modified file 'storage/innobase/read/read0read.c'
--- a/storage/innobase/read/read0read.c	revid:sneha.modi@oracle.com-20111121053150-8j5utwnf4rqq0516
+++ b/storage/innobase/read/read0read.c	revid:marko.makela@stripped121081955-7swepqssvrj8lfca
@@ -356,9 +356,10 @@ read_view_open_now_low(
 
 		assert_trx_in_rw_list(trx);
 
-		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->mutex. It may change
-		from ACTIVE to PREPARED or COMMITTED. */
+		/* The state of a read-write transaction cannot change
+		from or to NOT_STARTED while we are holding the
+		trx_sys->mutex. It may change from ACTIVE to PREPARED
+		or COMMITTED. */
 
 		if (trx->id != cr_trx_id
 		    && !trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)) {
@@ -645,9 +646,10 @@ read_cursor_view_create_for_mysql(
 
 		assert_trx_in_rw_list(trx);
 
-		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->mutex. It may change
-		from ACTIVE to PREPARED or COMMITTED. */
+		/* The state of a read-write transaction cannot change
+		from or to NOT_STARTED while we are holding the
+		trx_sys->mutex. It may change from ACTIVE to PREPARED
+		or COMMITTED. */
 		if (!trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)) {
 			ut_a(n_trx < view->n_trx_ids);
 

=== modified file 'storage/innobase/row/row0vers.c'
--- a/storage/innobase/row/row0vers.c	revid:sneha.modi@stripped21053150-8j5utwnf4rqq0516
+++ b/storage/innobase/row/row0vers.c	revid:marko.makela@strippedqssvrj8lfca
@@ -679,9 +679,10 @@ row_vers_build_for_semi_consistent_read(
 
 		mutex_enter(&trx_sys->mutex);
 		version_trx = trx_get_rw_trx_by_id(version_trx_id);
-		/* version_trx->state cannot change from or to
-		NOT_STARTED while we are holding the trx_sys->mutex.
-		It may change from ACTIVE to PREPARED or COMMITTED. */
+		/* Because version_trx is a read-write transaction,
+		its state cannot change from or to NOT_STARTED while
+		we are holding the trx_sys->mutex.  It may change from
+		ACTIVE to PREPARED or COMMITTED. */
 		if (version_trx
 		    && trx_state_eq(version_trx,
 				    TRX_STATE_COMMITTED_IN_MEMORY)) {

=== modified file 'storage/innobase/trx/trx0sys.c'
--- a/storage/innobase/trx/trx0sys.c	revid:sneha.modi@oracle.com-20111121053150-8j5utwnf4rqq0516
+++ b/storage/innobase/trx/trx0sys.c	revid:marko.makela@stripped121081955-7swepqssvrj8lfca
@@ -1840,6 +1840,7 @@ trx_sys_validate_trx_list_low(
 	     prev_trx = trx, trx = UT_LIST_GET_NEXT(trx_list, prev_trx)) {
 
 		assert_trx_in_list(trx);
+		ut_ad(trx->read_only == (trx_list == &trx_sys->ro_trx_list));
 
 		ut_a(prev_trx == NULL || prev_trx->id > trx->id);
 	}

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	revid:sneha.modi@stripped
+++ b/storage/innobase/trx/trx0trx.c	revid:marko.makela@oracle.com-20111121081955-7swepqssvrj8lfca
@@ -1878,10 +1878,10 @@ trx_recover_for_mysql(
 
 		assert_trx_in_rw_list(trx);
 
-		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->mutex. It may change
-		to PREPARED, but not if trx->is_recovered. It may also
-		change to COMMITTED. */
+		/* The state of a read-write transaction cannot change
+		from or to NOT_STARTED while we are holding the
+		trx_sys->mutex. It may change to PREPARED, but not if
+		trx->is_recovered. It may also change to COMMITTED. */
 		if (trx_state_eq(trx, TRX_STATE_PREPARED)) {
 			xid_list[count] = trx->xid;
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marko.makela:3635 to 3636) WL#6046marko.makela21 Nov