List:Commits« Previous MessageNext Message »
From:Sunny Bains Date:June 25 2010 3:15am
Subject:bzr push into mysql-next-mr-innodb branch (Sunny.Bains:3234 to 3235)
View as plain text  
 3235 Sunny Bains	2010-06-25
      Merge from 5.1 (r3436) -> trunk (r3123)-> next-mr
      
      Fix Bug# 54583. This change reverses r1530 by getting rid of a bogus assertion
      and clarifies the invariant in dict_table_get_on_id().
        
      In Mar 2007 Marko observed a crash during recovery, the crash resulted from
      an UNDO operation on a system table. His solution was to acquire an X lock on
      the data dictionary, this in hindsight was an overkill. It is unclear what
      caused the crash, current hypothesis is that it was a memory corruption.
        
      The X lock results in performance issues by when undoing changes due to
      rollback during normal operation on regular tables.
        
      Why the change is safe:
      ======================
      The InnoDB code has changed since the original X lock change was made. In the
      new code we always lock the data dictionary in X mode during startup when
      UNDOing operations on the system tables (this is a given). This ensures that
      the crash Marko observed cannot happen as long as all transactions that update
      the system tables follow the standard rules by setting the appropriate DICT_OP
      flag when writing the log records when they make the changes.
        
      If transactions violate the above mentioned rule then during recovery (at
      startup) the rollback code (see trx0roll.c) will not acquire the X lock
      and we will see the crash again.  This will however be a different bug.

    modified:
      storage/innobase/dict/dict0dict.c
      storage/innobase/include/sync0sync.h
      storage/innobase/row/row0undo.c
 3234 Jimmy Yang	2010-06-22
      Adjust test results with recent merge code from mysql-trunk-innodb to
      mysql-next-mr-innodb.

    modified:
      mysql-test/suite/innodb/r/innodb_monitor.result
      mysql-test/suite/innodb/t/innodb_monitor.test
      mysql-test/suite/sys_vars/r/all_vars.result
=== modified file 'storage/innobase/dict/dict0dict.c'
--- a/storage/innobase/dict/dict0dict.c	revid:jimmy.yang@stripped
+++ b/storage/innobase/dict/dict0dict.c	revid:sunny.bains@stripped
@@ -584,13 +584,11 @@ dict_table_get_on_id(
 
 	if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
 	    || trx->dict_operation_lock_mode == RW_X_LATCH) {
-		/* It is a system table which will always exist in the table
-		cache: we avoid acquiring the dictionary mutex, because
-		if we are doing a rollback to handle an error in TABLE
-		CREATE, for example, we already have the mutex! */
 
-		ut_ad(mutex_own(&(dict_sys->mutex))
-		      || trx->dict_operation_lock_mode == RW_X_LATCH);
+		/* Note: An X latch implies that the transaction
+		already owns the dictionary mutex. */
+
+		ut_ad(mutex_own(&dict_sys->mutex));
 
 		return(dict_table_get_on_id_low(table_id));
 	}

=== modified file 'storage/innobase/include/sync0sync.h'
--- a/storage/innobase/include/sync0sync.h	revid:jimmy.yang@stripped
+++ b/storage/innobase/include/sync0sync.h	revid:sunny.bains@stripped
@@ -621,7 +621,7 @@ or row lock! */
 #define SYNC_FILE_FORMAT_TAG	1200	/* Used to serialize access to the
 					file format tag */
 #define	SYNC_DICT_OPERATION	1001	/* table create, drop, etc. reserve
-					this in X-mode, implicit or backround
+					this in X-mode; implicit or backround
 					operations purge, rollback, foreign
 					key checks reserve this in S-mode */
 #define SYNC_DICT		1000

=== modified file 'storage/innobase/row/row0undo.c'
--- a/storage/innobase/row/row0undo.c	revid:jimmy.yang@stripped
+++ b/storage/innobase/row/row0undo.c	revid:sunny.bains@stripped
@@ -297,7 +297,7 @@ row_undo(
 
 	if (locked_data_dict) {
 
-		row_mysql_lock_data_dictionary(trx);
+		row_mysql_freeze_data_dictionary(trx);
 	}
 
 	if (node->state == UNDO_NODE_INSERT) {
@@ -312,7 +312,7 @@ row_undo(
 
 	if (locked_data_dict) {
 
-		row_mysql_unlock_data_dictionary(trx);
+		row_mysql_unfreeze_data_dictionary(trx);
 	}
 
 	/* Do some cleanup */


Attachment: [text/bzr-bundle] bzr/sunny.bains@oracle.com-20100625031140-uft64qfl95wzeif3.bundle
Thread
bzr push into mysql-next-mr-innodb branch (Sunny.Bains:3234 to 3235) Sunny Bains25 Jun