List:Commits« Previous MessageNext Message »
From:Jonathan Perkin Date:September 23 2011 12:56pm
Subject:bzr push into mysql-trunk branch (jonathan.perkin:3299 to 3305)
View as plain text  
 3305 Sunny Bains	2011-07-26
      Non-functional change, fix comments.

    modified:
      storage/innobase/include/trx0sys.ic
      storage/innobase/include/trx0trx.h
      storage/innobase/trx/trx0roll.c
      storage/innobase/trx/trx0trx.c
      storage/innobase/trx/trx0undo.c
 3304 Georgi Kodinov	2011-07-25
      Bug #12774208: DEFAULT_TEMP_STORAGE_ENGINE SHOULD BE NAMED 
      DEFAULT_TMP_STORAGE_ENGINE
      
      Remaned the option to be more consistent with other existing options.

    renamed:
      mysql-test/suite/sys_vars/r/default_temp_storage_engine_basic.result => mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result
      mysql-test/suite/sys_vars/t/default_temp_storage_engine_basic.test => mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test
    modified:
      cmake/create_initial_db.cmake.in
      mysql-test/include/mix1.inc
      mysql-test/lib/mtr_cases.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt
      mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/t/bootstrap-master.opt
      mysql-test/t/bootstrap.test
      mysql-test/t/ctype_utf8mb4-master.opt
      sql/mysqld.cc
      sql/mysqld.h
      sql/sys_vars.cc
      mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result
      mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test
 3303 Sunny Bains	2011-07-26
      Add innodb_rollback_segments to the all_vars.result file. This variable doesn't
      need a dedicated test of its own because it is an alias for innodb_undo_logs.

    modified:
      mysql-test/suite/sys_vars/r/all_vars.result
 3302 Sunny Bains	2011-07-26
      Bug 11765827 - 58830: INNODB: PERFORMANCE DROP IN SYSBENCH RANGE TESTS AT HIGH THREADS
      
      When splitting the kernel mutex I converted the primitive covering the trx
      lists to an rw_lock. At higher concurrency it is not efficient as a mutex. 
      
       1. Remove the trx_sys_t::read_view_mutex
          This was needed because we only had a shared lock on the trx_sys_t::lock
          when doing read view list operations. Now that we have a covering mutex
          it is no longer required.
      
       2. Convert trx_sys_t::lock to trx_sys_t::mutex
      
      Approved by Jimmy rb://702

    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/sync0sync.h
      storage/innobase/include/trx0sys.h
      storage/innobase/include/trx0sys.ic
      storage/innobase/include/trx0trx.ic
      storage/innobase/lock/lock0lock.c
      storage/innobase/read/read0read.c
      storage/innobase/row/row0ins.c
      storage/innobase/row/row0row.c
      storage/innobase/row/row0vers.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/sync/sync0sync.c
      storage/innobase/trx/trx0i_s.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/trx/trx0roll.c
      storage/innobase/trx/trx0rseg.c
      storage/innobase/trx/trx0sys.c
      storage/innobase/trx/trx0trx.c
 3301 Sunny Bains	2011-07-26
      WL#5535 renamed innodb_rollback_segments to innodb_undo_logs. Create an alias
      for backward compatibility.
      
      Approved by Jimmy over IM.

    modified:
      storage/innobase/handler/ha_innodb.cc
 3300 Vasil Dimov	2011-07-25
      Fix Bug#12783900 INNODB_BUFFER_POOL_FILENAME IS SOMETIMES NOT POPULATED
      BY THE EXPECTED TIME
      
      The bug in the test was that the dump status from the previous dump would
      remain and would satisfy the condition that is expected to wait for the
      second dump to complete. Thus the flow continued without the second dump
      completing and the second --file_exists failed.

    modified:
      mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
 3299 Marc Alff	2011-07-25
      Improved test robustness

    modified:
      mysql-test/suite/perfschema/t/stage_mdl_function.test
      mysql-test/suite/perfschema/t/stage_mdl_global.test
      mysql-test/suite/perfschema/t/stage_mdl_procedure.test
      mysql-test/suite/perfschema/t/stage_mdl_table.test
=== modified file 'cmake/create_initial_db.cmake.in'
--- a/cmake/create_initial_db.cmake.in	2011-07-25 09:26:08 +0000
+++ b/cmake/create_initial_db.cmake.in	2011-07-25 15:13:06 +0000
@@ -58,7 +58,7 @@ SET(BOOTSTRAP_COMMAND 
   --basedir=.
   --datadir=.
   --default-storage-engine=MyISAM
-  --default-temp-storage-engine=MyISAM
+  --default-tmp-storage-engine=MyISAM
   --loose-skip-innodb
   --loose-skip-ndbcluster
   --max_allowed_packet=8M

=== modified file 'mysql-test/include/mix1.inc'
--- a/mysql-test/include/mix1.inc	2011-07-08 12:30:52 +0000
+++ b/mysql-test/include/mix1.inc	2011-07-25 15:13:06 +0000
@@ -26,7 +26,7 @@
 #
 
 eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type;
-eval SET SESSION DEFAULT_TEMP_STORAGE_ENGINE = $engine_type;
+eval SET SESSION DEFAULT_TMP_STORAGE_ENGINE = $engine_type;
 
 --disable_warnings
 drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;

=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm	2011-07-04 12:59:01 +0000
+++ b/mysql-test/lib/mtr_cases.pm	2011-07-25 15:13:06 +0000
@@ -616,12 +616,12 @@ sub optimize_cases {
     foreach my $opt ( @{$tinfo->{master_opt}} ) {
       my $default_engine=
 	mtr_match_prefix($opt, "--default-storage-engine=");
-      my $default_temp_engine=
-	mtr_match_prefix($opt, "--default-temp-storage-engine=");
+      my $default_tmp_engine=
+	mtr_match_prefix($opt, "--default-tmp-storage-engine=");
 
       # Allow use of uppercase, convert to all lower case
       $default_engine =~ tr/A-Z/a-z/;
-      $default_temp_engine =~ tr/A-Z/a-z/;
+      $default_tmp_engine =~ tr/A-Z/a-z/;
 
       if (defined $default_engine){
 
@@ -644,26 +644,26 @@ sub optimize_cases {
 	$tinfo->{'innodb_test'}= 1
 	  if ( $default_engine =~ /^innodb/i );
       }
-      if (defined $default_temp_engine){
+      if (defined $default_tmp_engine){
 
 	#print " $tinfo->{name}\n";
-	#print " - The test asked to use '$default_temp_engine' as temp engine\n";
+	#print " - The test asked to use '$default_tmp_engine' as temp engine\n";
 
-	#my $engine_value= $::mysqld_variables{$default_temp_engine};
+	#my $engine_value= $::mysqld_variables{$default_tmp_engine};
 	#print " - The mysqld_variables says '$engine_value'\n";
 
-	if ( ! exists $::mysqld_variables{$default_temp_engine} and
-	     ! exists $builtin_engines{$default_temp_engine} )
+	if ( ! exists $::mysqld_variables{$default_tmp_engine} and
+	     ! exists $builtin_engines{$default_tmp_engine} )
 	{
 	  $tinfo->{'skip'}= 1;
 	  $tinfo->{'comment'}=
-	    "'$default_temp_engine' not supported";
+	    "'$default_tmp_engine' not supported";
 	}
 
 	$tinfo->{'ndb_test'}= 1
-	  if ( $default_temp_engine =~ /^ndb/i );
+	  if ( $default_tmp_engine =~ /^ndb/i );
 	$tinfo->{'innodb_test'}= 1
-	  if ( $default_temp_engine =~ /^innodb/i );
+	  if ( $default_tmp_engine =~ /^innodb/i );
       }
     }
 
@@ -1014,8 +1014,8 @@ sub collect_one_test_case {
     # the default storage engine is innodb.
     push(@{$tinfo->{'master_opt'}}, "--default-storage-engine=MyISAM");
     push(@{$tinfo->{'slave_opt'}}, "--default-storage-engine=MyISAM");
-    push(@{$tinfo->{'master_opt'}}, "--default-temp-storage-engine=MyISAM");
-    push(@{$tinfo->{'slave_opt'}}, "--default-temp-storage-engine=MyISAM");
+    push(@{$tinfo->{'master_opt'}}, "--default-tmp-storage-engine=MyISAM");
+    push(@{$tinfo->{'slave_opt'}}, "--default-tmp-storage-engine=MyISAM");
   }
 
   if ( $tinfo->{'need_binlog'} )

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-07-20 14:40:52 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-07-25 15:13:06 +0000
@@ -1370,11 +1370,11 @@ sub command_line_setup {
       collect_option('default-storage-engine', $1);
       mtr_report("Using default engine '$1'")
     }
-    if ( $arg =~ /default-temp-storage-engine=(\S+)/ )
+    if ( $arg =~ /default-tmp-storage-engine=(\S+)/ )
     {
       # Save this for collect phase
-      collect_option('default-temp-storage-engine', $1);
-      mtr_report("Using default temp engine '$1'")
+      collect_option('default-tmp-storage-engine', $1);
+      mtr_report("Using default tmp engine '$1'")
     }
   }
 

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2011-07-22 07:56:14 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2011-07-25 15:13:06 +0000
@@ -123,11 +123,11 @@ The following options may be given as th
  The DATETIME format (ignored)
  --default-storage-engine=name 
  The default storage engine for new tables
- --default-temp-storage-engine=name 
- The default storage engine for new explict temporary
- tables
  --default-time-zone=name 
  Set the default time zone.
+ --default-tmp-storage-engine=name 
+ The default storage engine for new explict temporary
+ tables
  --default-week-format=# 
  The default week format used by WEEK() functions
  --delay-key-write[=name] 
@@ -810,8 +810,8 @@ console FALSE
 date-format %Y-%m-%d
 datetime-format %Y-%m-%d %H:%i:%s
 default-storage-engine InnoDB
-default-temp-storage-engine InnoDB
 default-time-zone (No default value)
+default-tmp-storage-engine InnoDB
 default-week-format 0
 delay-key-write ON
 delayed-insert-limit 100

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2011-07-22 07:56:14 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2011-07-25 15:13:06 +0000
@@ -123,11 +123,11 @@ The following options may be given as th
  The DATETIME format (ignored)
  --default-storage-engine=name 
  The default storage engine for new tables
- --default-temp-storage-engine=name 
- The default storage engine for new explict temporary
- tables
  --default-time-zone=name 
  Set the default time zone.
+ --default-tmp-storage-engine=name 
+ The default storage engine for new explict temporary
+ tables
  --default-week-format=# 
  The default week format used by WEEK() functions
  --delay-key-write[=name] 
@@ -814,8 +814,8 @@ console FALSE
 date-format %Y-%m-%d
 datetime-format %Y-%m-%d %H:%i:%s
 default-storage-engine InnoDB
-default-temp-storage-engine InnoDB
 default-time-zone (No default value)
+default-tmp-storage-engine InnoDB
 default-week-format 0
 delay-key-write ON
 delayed-insert-limit 100

=== modified file 'mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt	2011-06-21 10:05:48 +0000
+++ b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt	2011-07-25 15:13:06 +0000
@@ -1 +1 @@
---innodb_lock_wait_timeout=2 --default-storage-engine=MyISAM --default-temp-storage-engine=MyISAM
+--innodb_lock_wait_timeout=2 --default-storage-engine=MyISAM --default-tmp-storage-engine=MyISAM

=== modified file 'mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt	2011-06-21 10:05:48 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt	2011-07-25 15:13:06 +0000
@@ -1 +1 @@
---innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE --default-storage-engine=MyISAM --default-temp-storage-engine=MyISAM
+--innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE --default-storage-engine=MyISAM --default-tmp-storage-engine=MyISAM

=== modified file 'mysql-test/suite/innodb/r/innodb_mysql.result'
--- a/mysql-test/suite/innodb/r/innodb_mysql.result	2011-07-20 14:40:52 +0000
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result	2011-07-25 15:13:06 +0000
@@ -1,7 +1,7 @@
 set global innodb_support_xa=default;
 set session innodb_support_xa=default;
 SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
-SET SESSION DEFAULT_TEMP_STORAGE_ENGINE = InnoDB;
+SET SESSION DEFAULT_TMP_STORAGE_ENGINE = InnoDB;
 drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
 drop procedure if exists p1;
 create table t1 (

=== modified file 'mysql-test/suite/sys_vars/r/all_vars.result'
--- a/mysql-test/suite/sys_vars/r/all_vars.result	2011-07-19 12:19:21 +0000
+++ b/mysql-test/suite/sys_vars/r/all_vars.result	2011-07-26 04:05:46 +0000
@@ -28,6 +28,8 @@ INNODB_MONITOR_RESET_ALL
 INNODB_MONITOR_RESET_ALL
 INNODB_PRINT_ALL_DEADLOCKS
 INNODB_PRINT_ALL_DEADLOCKS
+INNODB_ROLLBACK_SEGMENTS
+INNODB_ROLLBACK_SEGMENTS
 INNODB_STATS_METHOD
 INNODB_STATS_METHOD
 INNODB_STATS_PERSISTENT_SAMPLE_PAGES

=== renamed file 'mysql-test/suite/sys_vars/r/default_temp_storage_engine_basic.result' => 'mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result'
--- a/mysql-test/suite/sys_vars/r/default_temp_storage_engine_basic.result	2011-06-21 10:05:48 +0000
+++ b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result	2011-07-25 15:13:06 +0000
@@ -1,113 +1,113 @@
-SET @start_global_value = @@global.default_temp_storage_engine;
+SET @start_global_value = @@global.default_tmp_storage_engine;
 SELECT @start_global_value;
 @start_global_value
 InnoDB
-SET @start_session_value = @@session.default_temp_storage_engine;
+SET @start_session_value = @@session.default_tmp_storage_engine;
 SELECT @start_session_value;
 @start_session_value
 InnoDB
 '#--------------------FN_DYNVARS_005_01-------------------------#'
-SET @@global.default_temp_storage_engine = INNODB;
-SET @@global.default_temp_storage_engine = DEFAULT;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
-InnoDB
-SET @@session.default_temp_storage_engine = INNODB;
-SET @@session.default_temp_storage_engine = DEFAULT;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = INNODB;
+SET @@global.default_tmp_storage_engine = DEFAULT;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
+InnoDB
+SET @@session.default_tmp_storage_engine = INNODB;
+SET @@session.default_tmp_storage_engine = DEFAULT;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 InnoDB
 '#--------------------FN_DYNVARS_005_02-------------------------#'
-SET @@global.default_temp_storage_engine = MYISAM;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = MYISAM;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
 MyISAM
-SET @@global.default_temp_storage_engine = MERGE;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = MERGE;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
 MRG_MYISAM
-SET @@global.default_temp_storage_engine = MEMORY;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = MEMORY;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
 MEMORY
-SET @@global.default_temp_storage_engine = INNODB;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = INNODB;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
 InnoDB
 '#--------------------FN_DYNVARS_005_03-------------------------#'
-SET @@session.default_temp_storage_engine = MYISAM;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@session.default_tmp_storage_engine = MYISAM;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 MyISAM
-SET @@session.default_temp_storage_engine = MERGE;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@session.default_tmp_storage_engine = MERGE;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 MRG_MYISAM
-SET @@session.default_temp_storage_engine = MEMORY;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@session.default_tmp_storage_engine = MEMORY;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 MEMORY
-SET @@session.default_temp_storage_engine = INNODB;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@session.default_tmp_storage_engine = INNODB;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 InnoDB
 '#------------------FN_DYNVARS_005_04-----------------------#'
-SET @@global.default_temp_storage_engine = 8199;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@global.default_temp_storage_engine = NULL;
-ERROR 42000: Variable 'default_temp_storage_engine' can't be set to the value of 'NULL'
-SET @@global.default_temp_storage_engine = -1024;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@global.default_temp_storage_engine = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@global.default_temp_storage_engine = FILE;
+SET @@global.default_tmp_storage_engine = 8199;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@global.default_tmp_storage_engine = NULL;
+ERROR 42000: Variable 'default_tmp_storage_engine' can't be set to the value of 'NULL'
+SET @@global.default_tmp_storage_engine = -1024;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@global.default_tmp_storage_engine = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@global.default_tmp_storage_engine = FILE;
 ERROR 42000: Unknown storage engine 'FILE'
-SET @@session.default_temp_storage_engine = 8199;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@session.default_temp_storage_engine = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@session.default_temp_storage_engine = RECORD;
+SET @@session.default_tmp_storage_engine = 8199;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@session.default_tmp_storage_engine = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@session.default_tmp_storage_engine = RECORD;
 ERROR 42000: Unknown storage engine 'RECORD'
 '#------------------FN_DYNVARS_005_05-----------------------#'
-SELECT @@global.default_temp_storage_engine =
+SELECT @@global.default_tmp_storage_engine =
 VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='default_temp_storage_engine';
-@@global.default_temp_storage_engine =
+WHERE VARIABLE_NAME='default_tmp_storage_engine';
+@@global.default_tmp_storage_engine =
 VARIABLE_VALUE
 1
 '#------------------FN_DYNVARS_005_06-----------------------#'
-SELECT @@session.default_temp_storage_engine =
+SELECT @@session.default_tmp_storage_engine =
 VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='default_temp_storage_engine';
-@@session.default_temp_storage_engine =
+WHERE VARIABLE_NAME='default_tmp_storage_engine';
+@@session.default_tmp_storage_engine =
 VARIABLE_VALUE
 1
 '#------------------FN_DYNVARS_005_07-----------------------#'
-SET @@global.default_temp_storage_engine = TRUE;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
-SET @@global.default_temp_storage_engine = FALSE;
-ERROR 42000: Incorrect argument type to variable 'default_temp_storage_engine'
+SET @@global.default_tmp_storage_engine = TRUE;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
+SET @@global.default_tmp_storage_engine = FALSE;
+ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
 '#---------------------FN_DYNVARS_001_8----------------------#'
-SET @@default_temp_storage_engine = MYISAM;
-SELECT @@default_temp_storage_engine = @@local.default_temp_storage_engine;
-@@default_temp_storage_engine = @@local.default_temp_storage_engine
+SET @@default_tmp_storage_engine = MYISAM;
+SELECT @@default_tmp_storage_engine = @@local.default_tmp_storage_engine;
+@@default_tmp_storage_engine = @@local.default_tmp_storage_engine
 1
-SELECT @@local.default_temp_storage_engine = @@session.default_temp_storage_engine;
-@@local.default_temp_storage_engine = @@session.default_temp_storage_engine
+SELECT @@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine;
+@@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine
 1
 '#---------------------FN_DYNVARS_001_9----------------------#'
-SET default_temp_storage_engine = MEMORY;
-SELECT @@default_temp_storage_engine;
-@@default_temp_storage_engine
+SET default_tmp_storage_engine = MEMORY;
+SELECT @@default_tmp_storage_engine;
+@@default_tmp_storage_engine
 MEMORY
-SELECT local.default_temp_storage_engine;
+SELECT local.default_tmp_storage_engine;
 ERROR 42S02: Unknown table 'local' in field list
-SELECT session.default_temp_storage_engine;
+SELECT session.default_tmp_storage_engine;
 ERROR 42S02: Unknown table 'session' in field list
-SELECT default_temp_storage_engine = @@session.default_temp_storage_engine;
-ERROR 42S22: Unknown column 'default_temp_storage_engine' in 'field list'
-SET @@default_temp_storage_engine = @start_global_value;
-SET default_temp_storage_engine = MyISAM;
+SELECT default_tmp_storage_engine = @@session.default_tmp_storage_engine;
+ERROR 42S22: Unknown column 'default_tmp_storage_engine' in 'field list'
+SET @@default_tmp_storage_engine = @start_global_value;
+SET default_tmp_storage_engine = MyISAM;
 SET default_storage_engine = MyISAM;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
@@ -122,7 +122,7 @@ t2	CREATE TEMPORARY TABLE `t2` (
   `b` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1, t2;
-SET default_temp_storage_engine = InnoDB;
+SET default_tmp_storage_engine = InnoDB;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
 SHOW CREATE TABLE t1;
@@ -150,7 +150,7 @@ t2	CREATE TEMPORARY TABLE `t2` (
   `b` int(11) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
 DROP TABLE t1, t2;
-SET default_temp_storage_engine = DEFAULT;
+SET default_tmp_storage_engine = DEFAULT;
 SET default_storage_engine = DEFAULT;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
@@ -165,11 +165,11 @@ t2	CREATE TEMPORARY TABLE `t2` (
   `b` int(11) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
 DROP TABLE t1, t2;
-SET @@global.default_temp_storage_engine = @start_global_value;
-SELECT @@global.default_temp_storage_engine;
-@@global.default_temp_storage_engine
-InnoDB
-SET @@session.default_temp_storage_engine = @start_session_value;
-SELECT @@session.default_temp_storage_engine;
-@@session.default_temp_storage_engine
+SET @@global.default_tmp_storage_engine = @start_global_value;
+SELECT @@global.default_tmp_storage_engine;
+@@global.default_tmp_storage_engine
+InnoDB
+SET @@session.default_tmp_storage_engine = @start_session_value;
+SELECT @@session.default_tmp_storage_engine;
+@@session.default_tmp_storage_engine
 InnoDB

=== modified file 'mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result	2011-06-23 06:48:48 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result	2011-07-25 17:25:37 +0000
@@ -3,6 +3,7 @@ SELECT @orig;
 @orig
 ib_buffer_pool
 SET GLOBAL innodb_buffer_pool_dump_now = ON;
+SET @orig = @@global.innodb_buffer_pool_filename;
 SET GLOBAL innodb_buffer_pool_filename = 'innodb_foobar_dump';
 SET GLOBAL innodb_buffer_pool_dump_now = ON;
 SET GLOBAL innodb_buffer_pool_filename = @orig;

=== renamed file 'mysql-test/suite/sys_vars/t/default_temp_storage_engine_basic.test' => 'mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test'
--- a/mysql-test/suite/sys_vars/t/default_temp_storage_engine_basic.test	2011-06-21 10:05:48 +0000
+++ b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test	2011-07-25 15:13:06 +0000
@@ -3,7 +3,7 @@
 --source include/load_sysvars.inc
 
 ######################################################################
-#           START OF default_temp_storage_engine TESTS               #
+#           START OF default_tmp_storage_engine TESTS               #
 ######################################################################
 
 
@@ -11,84 +11,84 @@
 #                 Save initial value                        #
 #############################################################
 
-SET @start_global_value = @@global.default_temp_storage_engine;
+SET @start_global_value = @@global.default_tmp_storage_engine;
 SELECT @start_global_value;
-SET @start_session_value = @@session.default_temp_storage_engine;
+SET @start_session_value = @@session.default_tmp_storage_engine;
 SELECT @start_session_value;
 
 
 --echo '#--------------------FN_DYNVARS_005_01-------------------------#'
 ######################################################################
-#     Display the DEFAULT value of default_temp_storage_engine       #
+#     Display the DEFAULT value of default_tmp_storage_engine       #
 ######################################################################
 
-SET @@global.default_temp_storage_engine = INNODB;
-SET @@global.default_temp_storage_engine = DEFAULT;
-SELECT @@global.default_temp_storage_engine;
-
-SET @@session.default_temp_storage_engine = INNODB;
-SET @@session.default_temp_storage_engine = DEFAULT;
-SELECT @@session.default_temp_storage_engine;
+SET @@global.default_tmp_storage_engine = INNODB;
+SET @@global.default_tmp_storage_engine = DEFAULT;
+SELECT @@global.default_tmp_storage_engine;
+
+SET @@session.default_tmp_storage_engine = INNODB;
+SET @@session.default_tmp_storage_engine = DEFAULT;
+SELECT @@session.default_tmp_storage_engine;
 
 
 --echo '#--------------------FN_DYNVARS_005_02-------------------------#'
 ########################################################################
-# Change the value of default_temp_storage_engine to a valid value for GLOBAL Scope #
+# Change the value of default_tmp_storage_engine to a valid value for GLOBAL Scope #
 ########################################################################
 
-SET @@global.default_temp_storage_engine = MYISAM;
-SELECT @@global.default_temp_storage_engine;
-SET @@global.default_temp_storage_engine = MERGE;
-SELECT @@global.default_temp_storage_engine;
-SET @@global.default_temp_storage_engine = MEMORY;
-SELECT @@global.default_temp_storage_engine;
-SET @@global.default_temp_storage_engine = INNODB;
-SELECT @@global.default_temp_storage_engine;
+SET @@global.default_tmp_storage_engine = MYISAM;
+SELECT @@global.default_tmp_storage_engine;
+SET @@global.default_tmp_storage_engine = MERGE;
+SELECT @@global.default_tmp_storage_engine;
+SET @@global.default_tmp_storage_engine = MEMORY;
+SELECT @@global.default_tmp_storage_engine;
+SET @@global.default_tmp_storage_engine = INNODB;
+SELECT @@global.default_tmp_storage_engine;
 
 
 --echo '#--------------------FN_DYNVARS_005_03-------------------------#'
 #########################################################################
-# Change the value of default_temp_storage_engine to a valid value for SESSION Scope #
+# Change the value of default_tmp_storage_engine to a valid value for SESSION Scope #
 #########################################################################
  
-SET @@session.default_temp_storage_engine = MYISAM;
-SELECT @@session.default_temp_storage_engine;
-SET @@session.default_temp_storage_engine = MERGE;
-SELECT @@session.default_temp_storage_engine;
-SET @@session.default_temp_storage_engine = MEMORY;
-SELECT @@session.default_temp_storage_engine;
-SET @@session.default_temp_storage_engine = INNODB;
-SELECT @@session.default_temp_storage_engine;
+SET @@session.default_tmp_storage_engine = MYISAM;
+SELECT @@session.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = MERGE;
+SELECT @@session.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = MEMORY;
+SELECT @@session.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = INNODB;
+SELECT @@session.default_tmp_storage_engine;
 
 
 --echo '#------------------FN_DYNVARS_005_04-----------------------#'
 ##################################################################
-# Change the value of default_temp_storage_engine to an invalid value         #
+# Change the value of default_tmp_storage_engine to an invalid value         #
 ##################################################################
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.default_temp_storage_engine = 8199;
+SET @@global.default_tmp_storage_engine = 8199;
 
 --Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.default_temp_storage_engine = NULL;
+SET @@global.default_tmp_storage_engine = NULL;
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.default_temp_storage_engine = -1024;
+SET @@global.default_tmp_storage_engine = -1024;
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.default_temp_storage_engine = 65530.34;
+SET @@global.default_tmp_storage_engine = 65530.34;
 
 --Error ER_UNKNOWN_STORAGE_ENGINE
-SET @@global.default_temp_storage_engine = FILE;
+SET @@global.default_tmp_storage_engine = FILE;
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.default_temp_storage_engine = 8199;
+SET @@session.default_tmp_storage_engine = 8199;
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.default_temp_storage_engine = 65530.34;
+SET @@session.default_tmp_storage_engine = 65530.34;
 
 --Error ER_UNKNOWN_STORAGE_ENGINE
-SET @@session.default_temp_storage_engine = RECORD;
+SET @@session.default_tmp_storage_engine = RECORD;
 
 
 --echo '#------------------FN_DYNVARS_005_05-----------------------#'
@@ -97,18 +97,18 @@ SET @@session.default_temp_storage_engin
 ####################################################################
 
 
-SELECT @@global.default_temp_storage_engine =
+SELECT @@global.default_tmp_storage_engine =
  VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-  WHERE VARIABLE_NAME='default_temp_storage_engine';
+  WHERE VARIABLE_NAME='default_tmp_storage_engine';
 
 --echo '#------------------FN_DYNVARS_005_06-----------------------#'
 ####################################################################
 #  Check if the value in SESSION Table matches value in variable   #
 ####################################################################
 
-SELECT @@session.default_temp_storage_engine =
+SELECT @@session.default_tmp_storage_engine =
  VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-  WHERE VARIABLE_NAME='default_temp_storage_engine';
+  WHERE VARIABLE_NAME='default_tmp_storage_engine';
 
 
 --echo '#------------------FN_DYNVARS_005_07-----------------------#'
@@ -117,10 +117,10 @@ SELECT @@session.default_temp_storage_en
 ####################################################################
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.default_temp_storage_engine = TRUE;
+SET @@global.default_tmp_storage_engine = TRUE;
 
 --Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.default_temp_storage_engine = FALSE;
+SET @@global.default_tmp_storage_engine = FALSE;
 
 
 --echo '#---------------------FN_DYNVARS_001_8----------------------#'
@@ -129,29 +129,29 @@ SET @@global.default_temp_storage_engine
 #  SCOPE points to same session variable                      #
 ###############################################################
 
-SET @@default_temp_storage_engine = MYISAM;
-SELECT @@default_temp_storage_engine = @@local.default_temp_storage_engine;
-SELECT @@local.default_temp_storage_engine = @@session.default_temp_storage_engine;
+SET @@default_tmp_storage_engine = MYISAM;
+SELECT @@default_tmp_storage_engine = @@local.default_tmp_storage_engine;
+SELECT @@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine;
 
 
 --echo '#---------------------FN_DYNVARS_001_9----------------------#'
 #########################################################################
-#   Check if default_temp_storage_engine can be accessed with and without @@ sign    #
+#   Check if default_tmp_storage_engine can be accessed with and without @@ sign    #
 #########################################################################
 
-SET default_temp_storage_engine = MEMORY;
-SELECT @@default_temp_storage_engine;
+SET default_tmp_storage_engine = MEMORY;
+SELECT @@default_tmp_storage_engine;
 --Error ER_UNKNOWN_TABLE
-SELECT local.default_temp_storage_engine;
+SELECT local.default_tmp_storage_engine;
 --Error ER_UNKNOWN_TABLE
-SELECT session.default_temp_storage_engine;
+SELECT session.default_tmp_storage_engine;
 --Error ER_BAD_FIELD_ERROR
-SELECT default_temp_storage_engine = @@session.default_temp_storage_engine;
+SELECT default_tmp_storage_engine = @@session.default_tmp_storage_engine;
 
 # check the old obsolete name
-SET @@default_temp_storage_engine = @start_global_value;
+SET @@default_tmp_storage_engine = @start_global_value;
 
-SET default_temp_storage_engine = MyISAM;
+SET default_tmp_storage_engine = MyISAM;
 SET default_storage_engine = MyISAM;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
@@ -159,7 +159,7 @@ SHOW CREATE TABLE t1;
 SHOW CREATE TABLE t2;
 DROP TABLE t1, t2;
 
-SET default_temp_storage_engine = InnoDB;
+SET default_tmp_storage_engine = InnoDB;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
 SHOW CREATE TABLE t1;
@@ -173,7 +173,7 @@ SHOW CREATE TABLE t1;
 SHOW CREATE TABLE t2;
 DROP TABLE t1, t2;
 
-SET default_temp_storage_engine = DEFAULT;
+SET default_tmp_storage_engine = DEFAULT;
 SET default_storage_engine = DEFAULT;
 CREATE TABLE t1 (a INT);
 CREATE TEMPORARY TABLE t2 (b INT);
@@ -185,13 +185,13 @@ DROP TABLE t1, t2;
 #     Restore initial value        #
 ####################################
 
-SET @@global.default_temp_storage_engine = @start_global_value;
-SELECT @@global.default_temp_storage_engine;
-SET @@session.default_temp_storage_engine = @start_session_value;
-SELECT @@session.default_temp_storage_engine;
+SET @@global.default_tmp_storage_engine = @start_global_value;
+SELECT @@global.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = @start_session_value;
+SELECT @@session.default_tmp_storage_engine;
 
 
 #############################################################
-#       END OF default_temp_storage_engine TESTS            #
+#       END OF default_tmp_storage_engine TESTS            #
 #############################################################
 

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2011-06-23 06:48:48 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2011-07-25 17:25:37 +0000
@@ -4,7 +4,7 @@
 
 -- source include/have_innodb.inc
 
-# Check the default value and save for later restoration
+# Check the default value
 SET @orig = @@global.innodb_buffer_pool_filename;
 SELECT @orig;
 
@@ -24,6 +24,15 @@ let $wait_condition =
 
 # Try with a non-default filename
 
+# Restart the server so that the status gets reset to something other than
+# 'Buffer pool(s) dump completed at ', otherwise the following wait_condition
+# gets satisfied before the following dump has completed and --file_exists
+# fails
+-- source include/restart_mysqld.inc
+
+# Save for later restoration
+SET @orig = @@global.innodb_buffer_pool_filename;
+
 SET GLOBAL innodb_buffer_pool_filename = 'innodb_foobar_dump';
 
 SET GLOBAL innodb_buffer_pool_dump_now = ON;

=== modified file 'mysql-test/t/bootstrap-master.opt'
--- a/mysql-test/t/bootstrap-master.opt	2011-06-21 10:05:48 +0000
+++ b/mysql-test/t/bootstrap-master.opt	2011-07-25 15:13:06 +0000
@@ -1,3 +1,3 @@
 --default-storage-engine=MyISAM 
---default-temp-storage-engine=MyISAM 
+--default-tmp-storage-engine=MyISAM 
 --skip-innodb 

=== modified file 'mysql-test/t/bootstrap.test'
--- a/mysql-test/t/bootstrap.test	2011-06-21 10:05:48 +0000
+++ b/mysql-test/t/bootstrap.test	2011-07-25 15:13:06 +0000
@@ -8,7 +8,7 @@ drop table if exists t1;
 
 # Add the datadir to the bootstrap command
 let $MYSQLD_DATADIR= `select @@datadir`;
-let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --default-temp-storage-engine=MyISAM --skip-innodb;
+let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --default-tmp-storage-engine=MyISAM --skip-innodb;
 #
 # Check that --bootstrap reads from stdin
 #

=== modified file 'mysql-test/t/ctype_utf8mb4-master.opt'
--- a/mysql-test/t/ctype_utf8mb4-master.opt	2011-06-21 10:05:48 +0000
+++ b/mysql-test/t/ctype_utf8mb4-master.opt	2011-07-25 15:13:06 +0000
@@ -1,2 +1,2 @@
 --default-storage-engine=MyISAM
---default-temp-storage-engine=MyISAM
+--default-tmp-storage-engine=MyISAM

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-07-22 08:10:35 +0000
+++ b/sql/mysqld.cc	2011-07-25 15:13:06 +0000
@@ -339,7 +339,7 @@ static char *lc_time_names_name;
 char *my_bind_addr_str;
 static char *default_collation_name;
 char *default_storage_engine;
-char *default_temp_storage_engine;
+char *default_tmp_storage_engine;
 static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
 static I_List<THD> thread_cache;
 static bool binlog_format_used= false;
@@ -3343,7 +3343,7 @@ int init_common_variables()
 #else
   default_storage_engine= const_cast<char *>("InnoDB");
 #endif
-  default_temp_storage_engine= default_storage_engine;
+  default_tmp_storage_engine= default_storage_engine;
 
   /*
     Add server status variables to the dynamic list of
@@ -4402,7 +4402,7 @@ a file name for --log-bin-index option",
   if (initialize_storage_engine(default_storage_engine, "",
                                 &global_system_variables.table_plugin))
     unireg_abort(1);
-  if (initialize_storage_engine(default_temp_storage_engine, " temp",
+  if (initialize_storage_engine(default_tmp_storage_engine, " temp",
                                 &global_system_variables.temp_table_plugin))
     unireg_abort(1);
 
@@ -6168,9 +6168,9 @@ struct my_option my_long_options[]=
   {"default-storage-engine", 0, "The default storage engine for new tables",
    &default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0 },
-  {"default-temp-storage-engine", 0, 
+  {"default-tmp-storage-engine", 0, 
     "The default storage engine for new explict temporary tables",
-   &default_temp_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
+   &default_tmp_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0 },
   {"default-time-zone", 0, "Set the default time zone.",
    &default_tz_name, &default_tz_name,

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-07-21 16:27:14 +0000
+++ b/sql/mysqld.h	2011-07-25 15:13:06 +0000
@@ -129,7 +129,7 @@ extern my_bool opt_enable_shared_memory;
 extern char *default_tz_name;
 extern Time_zone *default_tz;
 extern char *default_storage_engine;
-extern char *default_temp_storage_engine;
+extern char *default_tmp_storage_engine;
 extern bool opt_endinfo, using_udf_functions;
 extern my_bool locked_in_memory;
 extern bool opt_using_transactions;

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-07-19 15:11:15 +0000
+++ b/sql/sys_vars.cc	2011-07-25 15:13:06 +0000
@@ -2500,10 +2500,10 @@ static Sys_var_plugin Sys_default_storag
        MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
        NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
 
-static Sys_var_plugin Sys_default_temp_storage_engine(
-       "default_temp_storage_engine", "The default storage engine for new explict temporary tables",
+static Sys_var_plugin Sys_default_tmp_storage_engine(
+       "default_tmp_storage_engine", "The default storage engine for new explict temporary tables",
        SESSION_VAR(temp_table_plugin), NO_CMD_LINE,
-       MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_temp_storage_engine),
+       MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine),
        NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
 
 //  Alias for @@default_storage_engine

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-07-19 15:07:48 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-07-26 03:21:33 +0000
@@ -292,15 +292,14 @@ static PSI_mutex_info all_innodb_mutexes
 	{&lock_sys_wait_mutex_key, "lock_wait_mutex", 0},
 	{&trx_mutex_key, "trx_mutex", 0},
 	{&srv_sys_tasks_mutex_key, "srv_threads_mutex", 0},
-	{&read_view_mutex_key, "read_view_mutex", 0},
-
 	/* mutex with os_fast_mutex_ interfaces */
 #  ifndef PFS_SKIP_EVENT_MUTEX
 	{&event_os_mutex_key, "event_os_mutex", 0},
 #  endif /* PFS_SKIP_EVENT_MUTEX */
 	{&os_mutex_key, "os_mutex", 0},
 	{&srv_conc_mutex_key, "srv_conc_mutex", 0},
-	{&ut_list_mutex_key, "ut_list_mutex", 0}
+	{&ut_list_mutex_key, "ut_list_mutex", 0},
+	{&trx_sys_mutex_key, "trx_sys_mutex", 0},
 };
 # endif /* UNIV_PFS_MUTEX */
 
@@ -325,7 +324,6 @@ static PSI_rwlock_info all_innodb_rwlock
 	{&trx_i_s_cache_lock_key, "trx_i_s_cache_lock", 0},
 	{&trx_purge_latch_key, "trx_purge_latch", 0},
 	{&index_tree_rw_lock_key, "index_tree_rw_lock", 0},
-	{&trx_sys_rw_lock_key, "trx_sys_lock", 0},
 	{&dict_table_stats_latch_key, "dict_table_stats", 0},
 	{&hash_table_rw_lock_key, "hash table locks", 0}
 };
@@ -2001,9 +1999,9 @@ read view to it if there is no read view
 Why a deadlock of threads is not possible: the query cache calls this function
 at the start of a SELECT processing. Then the calling thread cannot be
 holding any InnoDB semaphores. The calling thread is holding the
-query cache mutex, and this function will reserve the InnoDB trx_sys->lock.
+query cache mutex, and this function will reserve the InnoDB trx_sys->mutex.
 Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above
-the InnoDB trx_sys->lock.
+the InnoDB trx_sys->mutex.
 @return TRUE if permitted, FALSE if not; note that the value FALSE
 does not mean we should invalidate the query cache: invalidation is
 called explicitly */
@@ -2891,7 +2889,7 @@ innobase_start_trx_and_assign_read_view(
 	trx = check_trx_exists(thd);
 
 	/* This is just to play safe: release a possible FIFO ticket and
-	search latch. Since we can potentially reserve the trx_sys->lock,
+	search latch. Since we can potentially reserve the trx_sys->mutex,
 	we have to release the search system latch first to obey the latching
 	order. */
 
@@ -2936,7 +2934,7 @@ innobase_commit(
 
 	trx = check_trx_exists(thd);
 
-	/* Since we will reserve the trx_sys->lock, we have to release
+	/* Since we will reserve the trx_sys->mutex, we have to release
 	the search system latch first to obey the latching order. */
 
 	if (trx->has_search_latch) {
@@ -3075,7 +3073,7 @@ innobase_rollback(
 	trx = check_trx_exists(thd);
 
 	/* Release a possible FIFO ticket and search latch. Since we will
-	reserve the trx_sys->lock, we have to release the search system
+	reserve the trx_sys->mutex, we have to release the search system
 	latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -3115,7 +3113,7 @@ innobase_rollback_trx(
 	DBUG_PRINT("trans", ("aborting transaction"));
 
 	/* Release a possible FIFO ticket and search latch. Since we will
-	reserve the trx_sys->lock, we have to release the search system
+	reserve the trx_sys->mutex, we have to release the search system
 	latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -3156,7 +3154,7 @@ innobase_rollback_to_savepoint(
 	trx = check_trx_exists(thd);
 
 	/* Release a possible FIFO ticket and search latch. Since we will
-	reserve the trx_sys->lock, we have to release the search system
+	reserve the trx_sys->mutex, we have to release the search system
 	latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -3227,7 +3225,7 @@ innobase_savepoint(
 	trx = check_trx_exists(thd);
 
 	/* Release a possible FIFO ticket and search latch. Since we will
-	reserve the trx_sys->lock, we have to release the search system
+	reserve the trx_sys->mutex, we have to release the search system
 	latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -9491,7 +9489,7 @@ ha_innobase::external_lock(
 	prebuilt->mysql_has_locked = FALSE;
 
 	/* Release a possible FIFO ticket and search latch. Since we
-	may reserve the trx_sys->lock, we have to release the search
+	may reserve the trx_sys->mutex, we have to release the search
 	system latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -10691,7 +10689,7 @@ innobase_xa_prepare(
 	thd_get_xid(thd, (MYSQL_XID*) &trx->xid);
 
 	/* Release a possible FIFO ticket and search latch. Since we will
-	reserve the trx_sys->lock, we have to release the search system
+	reserve the trx_sys->mutex, we have to release the search system
 	latch first to obey the latching order. */
 
 	innobase_release_stat_resources(trx);
@@ -12496,6 +12494,15 @@ static MYSQL_SYSVAR_ULONG(undo_logs, srv
   1,			/* Minimum value */
   TRX_SYS_N_RSEGS, 0);	/* Maximum value */
 
+/* Alias for innodb_undo_logs, this config variable is deprecated. */
+static MYSQL_SYSVAR_ULONG(rollback_segments, srv_undo_logs,
+  PLUGIN_VAR_OPCMDARG,
+  "Number of undo logs to use (deprecated).",
+  NULL, NULL,
+  TRX_SYS_N_RSEGS,	/* Default setting */
+  1,			/* Minimum value */
+  TRX_SYS_N_RSEGS, 0);	/* Maximum value */
+
 static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
   "The AUTOINC lock modes supported by InnoDB:               "
@@ -12677,6 +12684,7 @@ static struct st_mysql_sys_var* innobase
 #endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */
   MYSQL_SYSVAR(print_all_deadlocks),
   MYSQL_SYSVAR(undo_logs),
+  MYSQL_SYSVAR(rollback_segments),
   MYSQL_SYSVAR(undo_directory),
   MYSQL_SYSVAR(undo_tablespaces),
   MYSQL_SYSVAR(sync_array_size),

=== modified file 'storage/innobase/include/sync0sync.h'
--- a/storage/innobase/include/sync0sync.h	2011-06-16 09:26:09 +0000
+++ b/storage/innobase/include/sync0sync.h	2011-07-26 03:21:33 +0000
@@ -111,7 +111,7 @@ extern mysql_pfs_key_t	trx_undo_mutex_ke
 extern mysql_pfs_key_t	trx_mutex_key;
 extern mysql_pfs_key_t	lock_sys_mutex_key;
 extern mysql_pfs_key_t	lock_sys_wait_mutex_key;
-extern mysql_pfs_key_t	read_view_mutex_key;
+extern mysql_pfs_key_t	trx_sys_mutex_key;
 extern mysql_pfs_key_t	srv_sys_mutex_key;
 extern mysql_pfs_key_t	srv_sys_tasks_mutex_key;
 extern mysql_pfs_key_t	srv_conc_mutex_key;
@@ -604,7 +604,7 @@ V
 lock_sys_mutex				Mutex protecting lock_sys_t
 |
 V
-trx_sys->lock				RW-lock protecting trx_sys_t
+trx_sys->mutex				Mutex protecting trx_sys_t
 |
 V
 Threads mutex				Background thread scheduling mutex
@@ -688,7 +688,6 @@ or row lock! */
 #define SYNC_LOCK_SYS		299
 #define SYNC_TRX_SYS		298
 #define SYNC_TRX		297
-#define SYNC_READ_VIEW		296
 #define SYNC_THREADS		295
 #define SYNC_REC_LOCK		294
 #define SYNC_TRX_SYS_HEADER	290

=== modified file 'storage/innobase/include/trx0sys.h'
--- a/storage/innobase/include/trx0sys.h	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/include/trx0sys.h	2011-07-26 03:21:33 +0000
@@ -132,8 +132,7 @@ ib_bh_t*
 trx_sys_init_at_db_start(void);
 /*==========================*/
 /*****************************************************************//**
-Creates the trx_sys instance and initializes ib_bh, lock and
-read_view_mutex. */
+Creates the trx_sys instance and initializes ib_bh and mutex. */
 UNIV_INTERN
 void
 trx_sys_create(void);
@@ -674,9 +673,9 @@ struct trx_doublewrite_struct{
 /** The transaction system central memory data structure. */
 struct trx_sys_struct{
 
-	rw_lock_t	lock;		/*!< read-write lock protecting most
-					fields in this structure except when
-					noted otherwise */
+	mutex_t		mutex;		/*!< mutex protecting most fields in
+					this structure except when noted
+					otherwise */
 	ulint		n_mysql_trx;	/*!< Number of transactions currently
 					allocated for MySQL */
 	ulint		n_prepared_trx;	/*!< Number of transactions currently
@@ -702,7 +701,6 @@ struct trx_sys_struct{
 					list (update undo logs for committed
 					transactions), protected by
 					rseg->mutex */
-	mutex_t		read_view_mutex;/*!< Protects the view_list */
 	UT_LIST_BASE_NODE_T(read_view_t) view_list;
 					/*!< List of read views sorted
 					on trx no, biggest first */

=== modified file 'storage/innobase/include/trx0sys.ic'
--- a/storage/innobase/include/trx0sys.ic	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/include/trx0sys.ic	2011-07-26 11:08:42 +0000
@@ -231,7 +231,7 @@ trx_read_trx_id(
 
 /****************************************************************//**
 Looks for the trx handle with the given id in trx_list.
-The caller must be holding trx_sys->lock.
+The caller must be holding trx_sys->mutex.
 @return	the trx handle or NULL if not found;
 the pointer must not be dereferenced unless lock_sys->mutex was
 acquired before calling this function and is still being held */
@@ -245,9 +245,7 @@ trx_get_on_id(
 	ulint		len;
 	trx_t*		first;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	len = UT_LIST_GET_LEN(trx_sys->trx_list);
 
@@ -300,7 +298,7 @@ trx_get_on_id(
 Returns the minimum trx id in trx list. This is the smallest id for which
 the trx can possibly be active. (But, you must look at the trx->state
 to find out if the minimum trx id transaction itself is active, or already
-committed.). The caller must be holding the trx_sys_t::lock in shared mode.
+committed.). The caller must be holding the trx_sys_t::mutex in shared mode.
 @return	the minimum trx id, or trx_sys->max_trx_id if the trx list is empty */
 UNIV_INLINE
 trx_id_t
@@ -310,9 +308,7 @@ trx_list_get_min_trx_id_low(void)
 	trx_id_t	id;
 	const trx_t*	trx;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	trx = UT_LIST_GET_LAST(trx_sys->trx_list);
 	ut_ad(trx == NULL || trx->in_trx_list);
@@ -334,11 +330,13 @@ trx_assert_recovered(
 {
 	const trx_t*	trx;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
+
 	trx = trx_get_on_id(trx_id);
 	ut_a(trx);
 	ut_a(trx->is_recovered);
-	rw_lock_s_unlock(&trx_sys->lock);
+
+	mutex_exit(&trx_sys->mutex);
 
 	return(TRUE);
 }
@@ -357,19 +355,19 @@ trx_list_get_min_trx_id(void)
 {
 	trx_id_t	id;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	id = trx_list_get_min_trx_id_low();
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(id);
 }
 
 /****************************************************************//**
 Checks if a transaction with the given id is active. Caller must hold
-trx_sys->lock in shared mode. If the caller is not holding
-lock_sys->mutex, the transaction may already have been committed.
+trx_sys->mutex. If the caller is not holding lock_sys->mutex, the
+transaction may already have been committed.
 @return	transaction instance if active, or NULL;
 the pointer must not be dereferenced unless lock_sys->mutex was
 acquired before calling this function and is still being held */
@@ -383,9 +381,7 @@ trx_is_active_low(
 {
 	trx_t*		trx;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	if (trx_id < trx_list_get_min_trx_id_low()) {
 
@@ -429,11 +425,11 @@ trx_is_active(
 {
 	trx_t*		trx;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	trx = trx_is_active_low(trx_id, corrupt);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(trx);
 }
@@ -446,9 +442,7 @@ trx_id_t
 trx_sys_get_new_trx_id(void)
 /*========================*/
 {
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	/* VERY important: after the database is started, max_trx_id value is
 	divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
@@ -474,17 +468,16 @@ trx_id_t
 trx_sys_get_max_trx_id(void)
 /*========================*/
 {
+	ut_ad(!mutex_own(&trx_sys->mutex));
+
 #if UNIV_WORD_SIZE < DATA_TRX_ID_LEN
 	trx_id_t	max_trx_id;
 	/* Avoid torn reads. */
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 	max_trx_id = trx_sys->max_trx_id;
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 	return(max_trx_id);
 #else
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
 	/* Perform a dirty read. Callers should be prepared for stale
 	values, and we know that the value fits in a machine word, so
 	that it will be read and written atomically. */
@@ -502,11 +495,11 @@ trx_sys_get_n_trx(void)
 {
 	ulint	n_trx;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	n_trx = UT_LIST_GET_LEN(trx_sys->trx_list);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(n_trx);
 }

=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h	2011-06-06 09:35:20 +0000
+++ b/storage/innobase/include/trx0trx.h	2011-07-26 11:08:42 +0000
@@ -668,7 +668,7 @@ struct trx_struct{
 					max trx id shortly before the
 					transaction is moved to
 					COMMITTED_IN_MEMORY state.
-					Protected by trx_sys_t::lock
+					Protected by trx_sys_t::mutex
 					when trx->in_trx_list. Initially
 					set to IB_ULONGLONG_MAX. */
 

=== modified file 'storage/innobase/include/trx0trx.ic'
--- a/storage/innobase/include/trx0trx.ic	2011-02-03 22:18:48 +0000
+++ b/storage/innobase/include/trx0trx.ic	2011-07-26 03:21:33 +0000
@@ -25,7 +25,7 @@ Created 3/26/1996 Heikki Tuuri
 
 /**********************************************************************//**
 Determines if a transaction is in the given state.
-The caller must hold trx_sys->lock, or it must be the thread
+The caller must hold trx_sys->mutex, or it must be the thread
 that is serving a running transaction.
 A running transaction must be in trx_sys->trx_list.
 @return	TRUE if trx->state == state */

=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	2011-07-13 05:08:21 +0000
+++ b/storage/innobase/lock/lock0lock.c	2011-07-26 03:21:33 +0000
@@ -1640,10 +1640,8 @@ lock_sec_rec_some_has_impl(
 	trx_id_t	max_trx_id;
 	const page_t*	page = page_align(rec);
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
 	ut_ad(!lock_mutex_own());
+	ut_ad(!mutex_own(&trx_sys->mutex));
 	ut_ad(!dict_index_is_clust(index));
 	ut_ad(page_rec_is_user_rec(rec));
 	ut_ad(rec_offs_validate(rec, index, offsets));
@@ -3463,7 +3461,7 @@ lock_deadlock_trx_print(
 	n_lock_struct = UT_LIST_GET_LEN(trx->lock.trx_locks);
 	heap_size = mem_heap_get_size(trx->lock.lock_heap);
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	trx_print_low(lock_latest_err_file, trx, max_query_len,
 		      n_lock_rec, n_lock_struct, heap_size);
@@ -3473,7 +3471,7 @@ lock_deadlock_trx_print(
 			      n_lock_rec, n_lock_struct, heap_size);
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 }
 
 /*********************************************************************//**
@@ -4703,7 +4701,7 @@ lock_remove_recovered_trx_record_locks(
 	ut_a(table != NULL);
 	ut_ad(lock_mutex_own());
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;
@@ -4747,7 +4745,7 @@ lock_remove_recovered_trx_record_locks(
 		++n_recovered_trx;
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(n_recovered_trx);
 }
@@ -5075,7 +5073,7 @@ lock_print_info_all_transactions(
 
 	ut_ad(lock_mutex_own());
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	/* First print info on non-active transactions */
 
@@ -5086,7 +5084,7 @@ lock_print_info_all_transactions(
 		ut_ad(trx->in_mysql_trx_list);
 
 		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->lock. It may change
+		while we are holding the trx_sys->mutex. It may change
 		from ACTIVE to PREPARED, but it may not change to
 		COMMITTED, because we are holding the lock_sys->mutex. */
 		if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
@@ -5097,7 +5095,7 @@ lock_print_info_all_transactions(
 
 loop:
 	/* Since we temporarily release lock_sys->mutex and
-	trx_sys->lock when reading a database page in below,
+	trx_sys->mutex when reading a database page in below,
 	variable trx may be obsolete now and we must loop
 	through the trx list to get probably the same trx,
 	or some other trx. */
@@ -5111,7 +5109,7 @@ loop:
 	if (trx == NULL) {
 
 		lock_mutex_exit();
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 		ut_ad(lock_validate());
 
@@ -5197,7 +5195,7 @@ loop:
 			}
 
 			lock_mutex_exit();
-			rw_lock_s_unlock(&trx_sys->lock);
+			mutex_exit(&trx_sys->mutex);
 
 			mtr_start(&mtr);
 
@@ -5210,7 +5208,7 @@ loop:
 
 			lock_mutex_enter();
 
-			rw_lock_s_lock(&trx_sys->lock);
+			mutex_enter(&trx_sys->mutex);
 
 			goto loop;
 		}
@@ -5290,16 +5288,14 @@ lock_table_queue_validate(
 	const lock_t*	lock;
 
 	ut_ad(lock_mutex_own());
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	for (lock = UT_LIST_GET_FIRST(table->locks);
 	     lock != NULL;
 	     lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) {
 
 		/* lock->trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->lock. It may change
+		while we are holding the trx_sys->mutex. It may change
 		from ACTIVE to PREPARED, but it may not change to
 		COMMITTED, because we are holding the lock_sys->mutex. */
 		ut_ad(trx_assert_started(lock->trx));
@@ -5345,16 +5341,12 @@ lock_rec_queue_validate(
 	ut_ad(rec_offs_validate(rec, index, offsets));
 	ut_ad(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
 	ut_ad(lock_mutex_own() == locked_lock_trx_sys);
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED)
-	      == locked_lock_trx_sys);
-#endif /* UNIV_SYNC_DEBUG */
 
 	heap_no = page_rec_get_heap_no(rec);
 
 	if (!locked_lock_trx_sys) {
 		lock_mutex_enter();
-		rw_lock_s_lock(&trx_sys->lock);
+		mutex_enter(&trx_sys->mutex);
 	}
 
 	if (!page_rec_is_user_rec(rec)) {
@@ -5431,7 +5423,7 @@ lock_rec_queue_validate(
 func_exit:
 	if (!locked_lock_trx_sys) {
 		lock_mutex_exit();
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 	}
 
 	return(TRUE);
@@ -5457,13 +5449,9 @@ lock_rec_validate_page(
 	rec_offs_init(offsets_);
 
 	ut_ad(!lock_mutex_own());
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
 
 	lock_mutex_enter();
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 loop:
 	lock = lock_rec_get_first_on_page_addr(buf_block_get_space(block),
 					       buf_block_get_page_no(block));
@@ -5528,7 +5516,7 @@ loop:
 
 function_exit:
 	lock_mutex_exit();
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	if (UNIV_LIKELY_NULL(heap)) {
 		mem_heap_free(heap);
@@ -5550,7 +5538,7 @@ lock_validate(void)
 
 	lock_mutex_enter();
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;
@@ -5599,7 +5587,7 @@ lock_validate(void)
 			}
 
 			lock_mutex_exit();
-			rw_lock_s_unlock(&trx_sys->lock);
+			mutex_exit(&trx_sys->mutex);
 
 			/* The lock and the block that it is referring
 			to may be freed at this point. We pass
@@ -5621,13 +5609,13 @@ lock_validate(void)
 			limit++;
 
 			lock_mutex_enter();
-			rw_lock_s_lock(&trx_sys->lock);
+			mutex_enter(&trx_sys->mutex);
 		}
 	}
 
 	lock_mutex_exit();
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(TRUE);
 }
@@ -6531,10 +6519,10 @@ lock_trx_release_locks(
 	trx_t*	trx)	/*!< in/out: transaction */
 {
 	if (UNIV_UNLIKELY(trx_state_eq(trx, TRX_STATE_PREPARED))) {
-		rw_lock_x_lock(&trx_sys->lock);
+		mutex_enter(&trx_sys->mutex);
 		ut_a(trx_sys->n_prepared_trx > 0);
 		trx_sys->n_prepared_trx--;
-		rw_lock_x_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 	} else {
 		ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
 	}
@@ -6652,7 +6640,7 @@ lock_table_locks_check(
 	ut_a(table != NULL);
 	ut_ad(lock_mutex_own());
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;
@@ -6676,7 +6664,7 @@ lock_table_locks_check(
 		}
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(NULL);
 }

=== modified file 'storage/innobase/read/read0read.c'
--- a/storage/innobase/read/read0read.c	2011-01-24 10:28:28 +0000
+++ b/storage/innobase/read/read0read.c	2011-07-26 03:21:33 +0000
@@ -167,11 +167,10 @@ For details see: row_vers_old_has_index_
 Some additional issues:
 
 What if trx_sys->view_list == NULL and some transaction T1 and Purge both
-try to open read_view at same time. Both can get trx_sys->lock in S mode.
+try to open read_view at same time. Only one can acquire trx_sys->mutex.
 In which order will the views be opened? Should it matter? If no, why?
 
-The order does not matter. Since both purge and transaction T1 will get the
-trx_sys->lock in S mode, no new transactions can be created and no running
+The order does not matter. No new transactions can be created and no running
 transaction can commit or rollback (or free views).
 */
 
@@ -186,9 +185,7 @@ read_view_validate(
 {
 	ulint	i;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	/* Check that the view->trx_ids array is in descending order. */
 	for (i = 1; i < view->n_trx_ids; ++i) {
@@ -209,11 +206,7 @@ read_view_list_validate(void)
 	const read_view_t*	view;
 	const read_view_t*	prev_view = NULL;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
-
-	mutex_enter(&trx_sys->read_view_mutex);
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	for (view = UT_LIST_GET_FIRST(trx_sys->view_list);
 	     view != NULL;
@@ -223,8 +216,6 @@ read_view_list_validate(void)
 		     || prev_view->low_limit_no >= view->low_limit_no);
 	}
 
-	mutex_exit(&trx_sys->read_view_mutex);
-
 	return(TRUE);
 }
 #endif
@@ -267,10 +258,7 @@ read_view_clone(
 	read_view_t*	clone;
 	read_view_t*	new_view;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
-	ut_ad(mutex_own(&trx_sys->read_view_mutex));
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	/* Allocate space for two views. */
 
@@ -308,13 +296,9 @@ read_view_add(
 	read_view_t*	elem;
 	read_view_t*	prev_elem;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 	ut_ad(read_view_validate(view));
 
-	mutex_enter(&trx_sys->read_view_mutex);
-
 	/* Find the correct slot for insertion. */
 	for (elem = UT_LIST_GET_FIRST(trx_sys->view_list), prev_elem = NULL;
 	     elem != NULL && view->low_limit_no < elem->low_limit_no;
@@ -329,8 +313,6 @@ read_view_add(
 			view_list, trx_sys->view_list, prev_elem, view);
 	}
 
-	mutex_exit(&trx_sys->read_view_mutex);
-
 	ut_ad(read_view_list_validate());
 }
 
@@ -351,9 +333,7 @@ read_view_open_now_low(
 	read_view_t*	view;
 	ulint		n_trx = UT_LIST_GET_LEN(trx_sys->trx_list);
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	view = read_view_create_low(n_trx, heap);
 
@@ -377,7 +357,7 @@ read_view_open_now_low(
 		ut_ad(trx->in_trx_list);
 
 		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->lock. It may change
+		while we are holding the trx_sys->mutex. It may change
 		from ACTIVE to PREPARED or COMMITTED. */
 
 		if (trx->id != cr_trx_id
@@ -392,7 +372,7 @@ read_view_open_now_low(
 			transaction starts, we initialize trx->no to
 			IB_ULONGLONG_MAX. */
 
-			/* trx->no is protected by trx_sys->lock, which
+			/* trx->no is protected by trx_sys->mutex, which
 			we are holding. It is assigned by trx_commit()
 			before lock_trx_release_locks() assigns
 			trx->state = TRX_STATE_COMMITTED_IN_MEMORY. */
@@ -434,11 +414,11 @@ read_view_open_now(
 {
 	read_view_t*	view;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	view = read_view_open_now_low(cr_trx_id, heap);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(view);
 }
@@ -462,19 +442,15 @@ read_view_purge_open(
 	trx_id_t	creator_trx_id;
 	ulint		insert_done	= 0;
 
-	rw_lock_s_lock(&trx_sys->lock);
-
-	mutex_enter(&trx_sys->read_view_mutex);
+	mutex_enter(&trx_sys->mutex);
 
 	oldest_view = UT_LIST_GET_LAST(trx_sys->view_list);
 
 	if (oldest_view == NULL) {
 
-		mutex_exit(&trx_sys->read_view_mutex);
-
 		view = read_view_open_now_low(0, heap);
 
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 		return(view);
 	}
@@ -483,8 +459,6 @@ read_view_purge_open(
 
 	oldest_view = read_view_clone(oldest_view, heap);
 
-	mutex_exit(&trx_sys->read_view_mutex);
-
 	ut_ad(read_view_validate(oldest_view));
 
 	ut_a(oldest_view->creator_trx_id > 0);
@@ -532,7 +506,7 @@ read_view_purge_open(
 
 	read_view_add(view);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(view);
 }
@@ -546,24 +520,15 @@ read_view_remove(
 	read_view_t*	view)	/*!< in: read view */
 {
 	/* We acquire an S lock for the debug validate code. */
-	ut_d(rw_lock_s_lock(&trx_sys->lock));
+	mutex_enter(&trx_sys->mutex);
 
 	ut_ad(read_view_validate(view));
 
-	ut_d(rw_lock_s_unlock(&trx_sys->lock));
-
-	mutex_enter(&trx_sys->read_view_mutex);
-
 	UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
 
-	mutex_exit(&trx_sys->read_view_mutex);
-
-	/* We acquire an S lock for the debug validate code. */
-	ut_d(rw_lock_s_lock(&trx_sys->lock));
-
 	ut_ad(read_view_list_validate());
 
-	ut_d(rw_lock_s_unlock(&trx_sys->lock));
+	mutex_exit(&trx_sys->mutex);
 }
 
 /*********************************************************************//**
@@ -656,7 +621,7 @@ read_cursor_view_create_for_mysql(
 
 	cr_trx->n_mysql_tables_in_use = 0;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	n_trx = UT_LIST_GET_LEN(trx_sys->trx_list);
 
@@ -681,7 +646,7 @@ read_cursor_view_create_for_mysql(
 	     trx = UT_LIST_GET_NEXT(trx_list, trx)) {
 
 		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->lock. It may change
+		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);
@@ -694,7 +659,7 @@ read_cursor_view_create_for_mysql(
 			transaction starts, we initialize trx->no to
 			IB_ULONGLONG_MAX. */
 
-			/* trx->no is protected by trx_sys->lock, which
+			/* trx->no is protected by trx_sys->mutex, which
 			we are holding. It is assigned by trx_commit()
 			before lock_trx_release_locks() assigns
 			trx->state = TRX_STATE_COMMITTED_IN_MEMORY. */
@@ -718,7 +683,7 @@ read_cursor_view_create_for_mysql(
 
 	read_view_add(view);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(curview);
 }
@@ -761,7 +726,7 @@ read_cursor_set_for_mysql(
 {
 	ut_a(trx);
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	if (UNIV_LIKELY(curview != NULL)) {
 		trx->read_view = curview->read_view;
@@ -771,5 +736,5 @@ read_cursor_set_for_mysql(
 
 	ut_ad(read_view_validate(trx->read_view));
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 }

=== modified file 'storage/innobase/row/row0ins.c'
--- a/storage/innobase/row/row0ins.c	2011-06-16 09:26:09 +0000
+++ b/storage/innobase/row/row0ins.c	2011-07-26 03:21:33 +0000
@@ -626,7 +626,7 @@ row_ins_foreign_trx_print(
 	heap_size = mem_heap_get_size(trx->lock.lock_heap);
 	lock_mutex_exit();
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	mutex_enter(&dict_foreign_err_mutex);
 	rewind(dict_foreign_err_file);
@@ -636,7 +636,7 @@ row_ins_foreign_trx_print(
 	trx_print_low(dict_foreign_err_file, trx, 600,
 		      n_lock_rec, n_lock_struct, heap_size);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	ut_ad(mutex_own(&dict_foreign_err_mutex));
 }

=== modified file 'storage/innobase/row/row0row.c'
--- a/storage/innobase/row/row0row.c	2011-07-08 13:40:10 +0000
+++ b/storage/innobase/row/row0row.c	2011-07-26 03:21:33 +0000
@@ -233,10 +233,7 @@ row_build(
 
 	ut_ad(index && rec && heap);
 	ut_ad(dict_index_is_clust(index));
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(!mutex_own(&trx_sys->mutex));
 
 	if (!offsets) {
 		offsets = rec_get_offsets(rec, index, offsets_,

=== modified file 'storage/innobase/row/row0vers.c'
--- a/storage/innobase/row/row0vers.c	2011-06-16 09:26:09 +0000
+++ b/storage/innobase/row/row0vers.c	2011-07-26 03:21:33 +0000
@@ -273,11 +273,8 @@ row_vers_impl_x_locked(
 	trx_id_t	trx_id;
 	mtr_t		mtr;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(!rw_lock_own(&purge_sys->latch, RW_LOCK_SHARED));
-	ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
 	ut_ad(!lock_mutex_own());
+	ut_ad(!mutex_own(&trx_sys->mutex));
 
 	mtr_start(&mtr);
 
@@ -676,17 +673,17 @@ row_vers_build_for_semi_consistent_read(
 			rec_trx_id = version_trx_id;
 		}
 
-		rw_lock_s_lock(&trx_sys->lock);
+		mutex_enter(&trx_sys->mutex);
 		version_trx = trx_get_on_id(version_trx_id);
 		/* version_trx->state cannot change from or to
-		NOT_STARTED while we are holding the trx_sys->lock.
+		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)) {
 			version_trx = NULL;
 		}
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 		if (!version_trx) {
 

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2011-07-20 04:43:44 +0000
+++ b/storage/innobase/srv/srv0srv.c	2011-07-26 03:21:33 +0000
@@ -1211,7 +1211,7 @@ srv_printf_innodb_monitor(
 		(long) srv_conc_n_threads,
 		srv_conc_get_waiting_threads());
 
-	/* This is a dirty read, without holding trx_sys->read_view_mutex. */
+	/* This is a dirty read, without holding trx_sys->mutex. */
 	fprintf(file, "%lu read views open inside InnoDB\n",
 		UT_LIST_GET_LEN(trx_sys->view_list));
 

=== modified file 'storage/innobase/sync/sync0sync.c'
--- a/storage/innobase/sync/sync0sync.c	2011-06-16 09:26:09 +0000
+++ b/storage/innobase/sync/sync0sync.c	2011-07-26 03:21:33 +0000
@@ -1221,7 +1221,6 @@ sync_thread_add_level(
 	case SYNC_SEARCH_SYS:
 	case SYNC_SEARCH_SYS_CONF:
 	case SYNC_THREADS:
-	case SYNC_READ_VIEW:
 	case SYNC_LOCK_SYS:
 	case SYNC_LOCK_WAIT_SYS:
 	case SYNC_TRX_SYS:

=== modified file 'storage/innobase/trx/trx0i_s.c'
--- a/storage/innobase/trx/trx0i_s.c	2011-03-28 09:15:58 +0000
+++ b/storage/innobase/trx/trx0i_s.c	2011-07-26 03:21:33 +0000
@@ -174,7 +174,7 @@ struct trx_i_s_cache_struct {
 	ha_storage_t*	storage;	/*!< storage for external volatile
 					data that may become unavailable
 					when we release
-					lock_sys->mutex or trx_sys->lock */
+					lock_sys->mutex or trx_sys->mutex */
 	ulint		mem_allocd;	/*!< the amount of memory
 					allocated with mem_alloc*() */
 	ibool		is_truncated;	/*!< this is TRUE if the memory
@@ -1281,9 +1281,7 @@ fetch_data_into_cache(
 	i_s_locks_row_t*	requested_lock_row;
 
 	ut_ad(lock_mutex_own());
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	trx_i_s_cache_clear(cache);
 
@@ -1347,11 +1345,11 @@ trx_i_s_possibly_fetch_data_into_cache(
 
 	lock_mutex_enter();
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	fetch_data_into_cache(cache);
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	lock_mutex_exit();
 

=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/trx/trx0purge.c	2011-07-26 03:21:33 +0000
@@ -263,11 +263,9 @@ trx_purge_add_update_undo_to_history(
 #ifdef HAVE_ATOMIC_BUILTINS
 	os_atomic_increment_ulint(&trx_sys->rseg_history_len, 1);
 #else
-	rw_lock_x_lock(&trx_sys->lock);
-
+	mutex_enter(&trx_sys->mutex);
 	++trx_sys->rseg_history_len;
-
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 #endif /* HAVE_ATOMIC_BUILTINS */
 
 	srv_wake_purge_thread_if_not_active();
@@ -371,11 +369,9 @@ trx_purge_free_segment(
 #ifdef HAVE_ATOMIC_BUILTINS
 	os_atomic_decrement_ulint(&trx_sys->rseg_history_len, n_removed_logs);
 #else
-	rw_lock_x_lock(&trx_sys->lock);
-
+	mutex_enter(&trx_sys->mutex);
 	trx_sys->rseg_history_len -= n_removed_logs;
-
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 #endif /* HAVE_ATOMIC_BUILTINS */
 
 	do {
@@ -460,11 +456,9 @@ loop:
 		os_atomic_decrement_ulint(
 			&trx_sys->rseg_history_len, n_removed_logs);
 #else
-		rw_lock_x_lock(&trx_sys->lock);
-
+		mutex_enter(&trx_sys->mutex);
 		trx_sys->rseg_history_len -= n_removed_logs;
-
-		rw_lock_x_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);	
 #endif /* HAVE_ATOMIC_BUILTINS */
 
 		flst_truncate_end(rseg_hdr + TRX_RSEG_HISTORY,
@@ -593,7 +587,7 @@ trx_purge_rseg_get_next_history_log(
 		mutex_exit(&(rseg->mutex));
 		mtr_commit(&mtr);
 
-		rw_lock_s_lock(&trx_sys->lock);
+		mutex_enter(&trx_sys->mutex);
 
 		/* Add debug code to track history list corruption reported
 		on the MySQL mailing list on Nov 9, 2004. The fut0lst.c
@@ -615,7 +609,7 @@ trx_purge_rseg_get_next_history_log(
 				(ulong) trx_sys->rseg_history_len);
 		}
 
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 		return;
 	}
@@ -1095,7 +1089,7 @@ trx_purge_dml_delay(void)
 	'consistent read view', then the DML statements cannot be delayed.
 	Also, srv_max_purge_lag <= 0 means 'infinity'. Note: we do a dirty
 	read of the trx_sys_t data structure here, without holding
-	trx_sys->read_view_mutex. */
+	trx_sys->mutex. */
 	if (srv_max_purge_lag > 0
 	    && !UT_LIST_GET_LAST(trx_sys->view_list)) {
 		float	ratio = (float) trx_sys->rseg_history_len

=== modified file 'storage/innobase/trx/trx0roll.c'
--- a/storage/innobase/trx/trx0roll.c	2011-04-05 11:12:48 +0000
+++ b/storage/innobase/trx/trx0roll.c	2011-07-26 11:08:42 +0000
@@ -161,7 +161,7 @@ trx_rollback_for_mysql(
 /*===================*/
 	trx_t*	trx)	/*!< in/out: transaction */
 {
-	/* We are reading trx->state without holding trx_sys->lock
+	/* We are reading trx->state without holding trx_sys->mutex
 	here, because the rollback should be invoked for a running
 	active MySQL transaction (or recovered prepared transaction)
 	that is associated with the current thread. */
@@ -213,7 +213,7 @@ trx_rollback_last_sql_stat_for_mysql(
 {
 	int	err;
 
-	/* We are reading trx->state without holding trx_sys->lock
+	/* We are reading trx->state without holding trx_sys->mutex
 	here, because the statement rollback should be invoked for a
 	running active MySQL transaction that is associated with the
 	current thread. */
@@ -381,7 +381,7 @@ trx_rollback_to_savepoint_for_mysql(
 {
 	trx_named_savept_t*	savep;
 
-	/* We are reading trx->state without holding trx_sys->lock
+	/* We are reading trx->state without holding trx_sys->mutex
 	here, because the savepoint rollback should be invoked for a
 	running active MySQL transaction that is associated with the
 	current thread. */
@@ -550,7 +550,7 @@ trx_rollback_active(
 
 	ut_a(thr == que_fork_start_command(fork));
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	trx_roll_crash_recv_trx	= trx;
 
@@ -560,7 +560,7 @@ trx_rollback_active(
 
 	rows_to_undo = trx_roll_max_undo_no;
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	if (rows_to_undo > 1000000000) {
 		rows_to_undo = rows_to_undo / 1000000;
@@ -642,10 +642,10 @@ trx_rollback_active(
 
 /*******************************************************************//**
 Rollback or clean up any resurrected incomplete transactions. It assumes
-that the caller holds the trx_sys_t::lock in S mode and it will release the
+that the caller holds the trx_sys_t::mutex and it will release the
 lock if it does a clean up or rollback.
 @return TRUE if the transaction was cleaned up or rolled back
-and trx_sys->lock was released. */
+and trx_sys->mutex was released. */
 static
 ibool
 trx_rollback_resurrected(
@@ -654,9 +654,7 @@ trx_rollback_resurrected(
 	ibool	all)	/*!< in: FALSE=roll back dictionary transactions;
 			TRUE=roll back all non-PREPARED transactions */
 {
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	/* The trx->is_recovered flag and trx->state are set
 	atomically under the protection of the trx->mutex (and
@@ -672,7 +670,7 @@ trx_rollback_resurrected(
 
 	switch (trx->state) {
 	case TRX_STATE_COMMITTED_IN_MEMORY:
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 		trx_mutex_exit(trx);
 		fprintf(stderr,
 			"InnoDB: Cleaning up trx with id " TRX_ID_FMT "\n",
@@ -682,7 +680,7 @@ trx_rollback_resurrected(
 	case TRX_STATE_ACTIVE:
 		trx_mutex_exit(trx);
 		if (all || trx_get_dict_operation(trx) != TRX_DICT_OP_NONE) {
-			rw_lock_s_unlock(&trx_sys->lock);
+			mutex_exit(&trx_sys->mutex);
 			trx_rollback_active(trx);
 			return(TRUE);
 		}
@@ -732,7 +730,7 @@ trx_rollback_or_clean_recovered(
 	recovered transactions to clean up or recover. */
 
 	do {
-		rw_lock_s_lock(&trx_sys->lock);
+		mutex_enter(&trx_sys->mutex);
 
 		for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 		     trx != NULL;
@@ -741,18 +739,18 @@ trx_rollback_or_clean_recovered(
 			ut_ad(trx->in_trx_list);
 
 			/* If this function does a cleanup or rollback
-			then it will release the trx_sys->lock, therefore
+			then it will release the trx_sys->mutex, therefore
 			we need to reacquire it before retrying the loop. */
 
 			if (trx_rollback_resurrected(trx, all)) {
 
-				rw_lock_s_lock(&trx_sys->lock);
+				mutex_enter(&trx_sys->mutex);
 
 				break;
 			}
 		}
 
-		rw_lock_s_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 	} while (trx != NULL);
 

=== modified file 'storage/innobase/trx/trx0rseg.c'
--- a/storage/innobase/trx/trx0rseg.c	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/trx/trx0rseg.c	2011-07-26 03:21:33 +0000
@@ -309,7 +309,7 @@ trx_rseg_create(
 	mtr_start(&mtr);
 
 	/* To obey the latching order, acquire the file space
-	x-latch before the trx_sys->lock. */
+	x-latch before the trx_sys->mutex. */
 	mtr_x_lock(fil_space_get_latch(space, NULL), &mtr);
 
 	slot_no = trx_sysf_rseg_find_free(&mtr);

=== modified file 'storage/innobase/trx/trx0sys.c'
--- a/storage/innobase/trx/trx0sys.c	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/trx/trx0sys.c	2011-07-26 03:21:33 +0000
@@ -132,13 +132,7 @@ static const ulint	FILE_FORMAT_NAME_N
 /* Key to register the mutex with performance schema */
 UNIV_INTERN mysql_pfs_key_t	trx_doublewrite_mutex_key;
 UNIV_INTERN mysql_pfs_key_t	file_format_max_mutex_key;
-/* Key to register the trx_sys->read_view_mutex with performance schema */
-UNIV_INTERN mysql_pfs_key_t	read_view_mutex_key;
-#endif /* UNIV_PFS_MUTEX */
-
-#ifdef UNIV_PFS_RWLOCK
-/* Key to register the trx_sys->lock with performance schema */
-UNIV_INTERN mysql_pfs_key_t	trx_sys_rw_lock_key;
+UNIV_INTERN mysql_pfs_key_t	trx_sys_mutex_key;
 #endif /* UNIV_PFS_RWLOCK */
 
 #ifndef UNIV_HOTBACKUP
@@ -648,9 +642,7 @@ trx_in_trx_list(
 {
 	const trx_t*	trx;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	ut_ad(trx_assert_started(in_trx));
 
@@ -675,10 +667,7 @@ trx_sys_flush_max_trx_id(void)
 	mtr_t		mtr;
 	trx_sysf_t*	sys_header;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED)
-	      || rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	mtr_start(&mtr);
 
@@ -1034,7 +1023,7 @@ trx_sys_init_at_db_start(void)
 	the debug code (assertions). We are still running in single threaded
 	bootstrap mode. */
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	if (UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
 		const trx_t*	trx;
@@ -1065,7 +1054,7 @@ trx_sys_init_at_db_start(void)
 			(ullint) trx_sys->max_trx_id);
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	UT_LIST_INIT(trx_sys->view_list);
 
@@ -1075,8 +1064,7 @@ trx_sys_init_at_db_start(void)
 }
 
 /*****************************************************************//**
-Creates the trx_sys instance and initializes ib_bh, lock and
-read_view_mutex. */
+Creates the trx_sys instance and initializes ib_bh and mutex. */
 UNIV_INTERN
 void
 trx_sys_create(void)
@@ -1086,10 +1074,7 @@ trx_sys_create(void)
 
 	trx_sys = mem_zalloc(sizeof(*trx_sys));
 
-	rw_lock_create(trx_sys_rw_lock_key, &trx_sys->lock, SYNC_TRX_SYS);
-
-	mutex_create(
-		read_view_mutex_key, &trx_sys->read_view_mutex, SYNC_READ_VIEW);
+	mutex_create(trx_sys_mutex_key, &trx_sys->mutex, SYNC_TRX_SYS);
 }
 
 /*****************************************************************//**
@@ -1669,7 +1654,7 @@ trx_sys_close(void)
 	/* Check that all read views are closed except read view owned
 	by a purge. */
 
-	mutex_enter(&trx_sys->read_view_mutex);
+	mutex_enter(&trx_sys->mutex);
 
 	if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
 		fprintf(stderr,
@@ -1679,7 +1664,7 @@ trx_sys_close(void)
 			UT_LIST_GET_LEN(trx_sys->view_list) - 1);
 	}
 
-	mutex_exit(&trx_sys->read_view_mutex);
+	mutex_exit(&trx_sys->mutex);
 
 	sess_close(trx_dummy_sess);
 	trx_dummy_sess = NULL;
@@ -1698,7 +1683,7 @@ trx_sys_close(void)
 	mem_free(trx_doublewrite);
 	trx_doublewrite = NULL;
 
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	/* Only prepared transactions may be left in the system. Free them. */
 	ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == trx_sys->n_prepared_trx);
@@ -1707,8 +1692,6 @@ trx_sys_close(void)
 		trx_free_prepared(trx);
 	}
 
-	mutex_free(&trx_sys->read_view_mutex);
-
 	/* There can't be any active transactions. */
 	for (i = 0; i < TRX_SYS_N_RSEGS; ++i) {
 		trx_rseg_t*	rseg;
@@ -1738,9 +1721,9 @@ trx_sys_close(void)
 	ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0);
 	ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
 
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
-	rw_lock_free(&trx_sys->lock);
+	mutex_free(&trx_sys->mutex);
 
 	mem_free(trx_sys);
 
@@ -1757,14 +1740,14 @@ trx_sys_any_active_transactions(void)
 {
 	ulint	total_trx = 0;
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	total_trx = UT_LIST_GET_LEN(trx_sys->trx_list)
 		+ trx_sys->n_mysql_trx;
 	ut_a(total_trx >= trx_sys->n_prepared_trx);
 	total_trx -= trx_sys->n_prepared_trx;
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(total_trx);
 }
@@ -1780,10 +1763,7 @@ trx_sys_validate_trx_list(void)
 	const trx_t*	trx;
 	const trx_t*	prev_trx = NULL;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_EX)
-	      || rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/trx/trx0trx.c	2011-07-26 11:08:42 +0000
@@ -172,14 +172,14 @@ trx_allocate_for_mysql(void)
 
 	trx = trx_allocate_for_background();
 
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	trx_sys->n_mysql_trx++;
 
 	ut_d(trx->in_mysql_trx_list = TRUE);
 	UT_LIST_ADD_FIRST(mysql_trx_list, trx_sys->mysql_trx_list, trx);
 
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(trx);
 }
@@ -297,9 +297,7 @@ trx_free_prepared(
 /*==============*/
 	trx_t*	trx)	/*!< in, own: trx object */
 {
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
 	ut_a(trx->magic_n == TRX_MAGIC_N);
@@ -319,7 +317,7 @@ trx_free_for_mysql(
 /*===============*/
 	trx_t*	trx)	/*!< in, own: trx object */
 {
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	ut_ad(trx->in_mysql_trx_list);
 	ut_d(trx->in_mysql_trx_list = FALSE);
@@ -329,7 +327,7 @@ trx_free_for_mysql(
 
 	trx_sys->n_mysql_trx--;
 
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	trx_free_for_background(trx);
 }
@@ -404,7 +402,7 @@ trx_resurrect_insert(
 	trx->is_recovered = TRUE;
 
 	/* This is single-threaded startup code, we do not need the
-	protection of trx->mutex or trx_sys->lock here. */
+	protection of trx->mutex or trx_sys->mutex here. */
 
 	if (undo->state != TRX_UNDO_ACTIVE) {
 
@@ -471,11 +469,11 @@ trx_resurrect_update_in_prepared_state(
 	const trx_undo_t*	undo)	/*!< in: update UNDO record */
 {
 	/* This is single-threaded startup code, we do not need the
-	protection of trx->mutex or trx_sys->lock here. */
+	protection of trx->mutex or trx_sys->mutex here. */
 
 	if (undo->state == TRX_UNDO_PREPARED) {
 		fprintf(stderr,
-			"InnoDB: Transaction " TRX_ID_FMT 
+			"InnoDB: Transaction " TRX_ID_FMT
 			" was in the XA prepared state.\n", trx->id);
 
 		if (srv_force_recovery == 0) {
@@ -516,7 +514,7 @@ trx_resurrect_update(
 	trx->is_recovered = TRUE;
 
 	/* This is single-threaded startup code, we do not need the
-	protection of trx->mutex or trx_sys->lock here. */
+	protection of trx->mutex or trx_sys->mutex here. */
 
 	if (undo->state != TRX_UNDO_ACTIVE) {
 		trx_resurrect_update_in_prepared_state(trx, undo);
@@ -594,9 +592,9 @@ trx_lists_init_at_db_start(void)
 			ibool	trx_created;
 
 			/* Check the trx_sys->trx_list first. */
-			rw_lock_s_lock(&trx_sys->lock);
+			mutex_enter(&trx_sys->mutex);
 			trx = trx_get_on_id(undo->trx_id);
-			rw_lock_s_unlock(&trx_sys->lock);
+			mutex_exit(&trx_sys->mutex);
 
 			if (trx == NULL) {
 				trx = trx_allocate_for_background();
@@ -695,11 +693,11 @@ trx_start_low(
 	ut_a(ib_vector_is_empty(trx->autoinc_locks));
 	ut_a(ib_vector_is_empty(trx->lock.table_locks));
 
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	/* If this transaction came from trx_allocate_for_mysql(),
 	trx->in_mysql_trx_list would hold. In that case, the trx->state
-	change must be protected by the trx_sys->lock, so that
+	change must be protected by the trx_sys->mutex, so that
 	lock_print_info_all_transactions() will have a consistent view. */
 
 	trx->state = TRX_STATE_ACTIVE;
@@ -712,7 +710,7 @@ trx_start_low(
 
 	ut_ad(trx_sys_validate_trx_list());
 
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	MONITOR_INC(MONITOR_TRX_ACTIVE);
 }
@@ -731,7 +729,7 @@ trx_serialisation_number_get(
 
 	ut_ad(mutex_own(&rseg->mutex));
 
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	trx->no = trx_sys_get_new_trx_id();
 
@@ -749,19 +747,19 @@ trx_serialisation_number_get(
 
 		mutex_enter(&purge_sys->bh_mutex);
 
-		/* This is to reduce the pressure on the trx_sys_t::lock
+		/* This is to reduce the pressure on the trx_sys_t::mutex
 		though in reality it should make very little (read no)
 		difference because this code path is only taken when the
 		rbs is empty. */
 
-		rw_lock_x_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 
 		ptr = ib_bh_push(purge_sys->ib_bh, &rseg_queue);
 		ut_a(ptr);
 
 		mutex_exit(&purge_sys->bh_mutex);
 	} else {
-		rw_lock_x_unlock(&trx_sys->lock);
+		mutex_exit(&trx_sys->mutex);
 	}
 }
 
@@ -892,20 +890,20 @@ trx_commit(
 	now that it no longer holds any user locks. */
 
 	ut_ad(trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY));
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 	ut_ad(trx->in_trx_list);
 	ut_d(trx->in_trx_list = FALSE);
 	UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
 
 	/* If this transaction came from trx_allocate_for_mysql(),
 	trx->in_mysql_trx_list would hold. In that case, the
-	trx->state change must be protected by trx_sys->lock, so that
+	trx->state change must be protected by trx_sys->mutex, so that
 	lock_print_info_all_transactions() will have a consistent view. */
 
 	trx->state = TRX_STATE_NOT_STARTED;
 	ut_ad(trx_sys_validate_trx_list());
 	MONITOR_INC(MONITOR_TRX_COMMIT);
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	if (trx->global_read_view != NULL) {
 		read_view_remove(trx->global_read_view);
@@ -1017,13 +1015,13 @@ trx_cleanup_at_db_startup(
 	trx->undo_no = 0;
 	trx->last_sql_stat_start.least_undo_no = 0;
 
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
 	ut_ad(trx->in_trx_list);
 	ut_d(trx->in_trx_list = FALSE);
 
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	/* Change the transaction state without mutex protection, now
 	that it no longer is in the trx_list. Recovered transactions
@@ -1070,7 +1068,7 @@ trx_commit_or_rollback_prepare(
 /*===========================*/
 	trx_t*	trx)		/*!< in/out: transaction */
 {
-	/* We are reading trx->state without holding trx_sys->lock
+	/* We are reading trx->state without holding trx_sys->mutex
 	here, because the commit or rollback should be invoked for a
 	running (or recovered prepared) transaction that is associated
 	with the current thread. */
@@ -1289,7 +1287,7 @@ trx_mark_sql_stat_end(
 
 /**********************************************************************//**
 Prints info about a transaction.
-Caller must hold trx_sys->lock. */
+Caller must hold trx_sys->mutex. */
 UNIV_INTERN
 void
 trx_print_low(
@@ -1311,14 +1309,12 @@ trx_print_low(
 	ibool		newline;
 	const char*	op_info;
 
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	fprintf(f, "TRANSACTION " TRX_ID_FMT, (ullint) trx->id);
 
 	/* trx->state cannot change from or to NOT_STARTED while we
-	are holding the trx_sys->lock. It may change from ACTIVE to
+	are holding the trx_sys->mutex. It may change from ACTIVE to
 	PREPARED or COMMITTED. */
 	switch (trx->state) {
 	case TRX_STATE_NOT_STARTED:
@@ -1416,7 +1412,7 @@ state_ok:
 
 /**********************************************************************//**
 Prints info about a transaction.
-The caller must hold lock_sys->mutex and trx_sys->lock.
+The caller must hold lock_sys->mutex and trx_sys->mutex.
 When possible, use trx_print() instead. */
 UNIV_INTERN
 void
@@ -1428,9 +1424,7 @@ trx_print_latched(
 					or 0 to use the default max length */
 {
 	ut_ad(lock_mutex_own());
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	trx_print_low(f, trx, max_query_len,
 		      lock_number_of_rows_locked(&trx->lock),
@@ -1440,7 +1434,7 @@ trx_print_latched(
 
 /**********************************************************************//**
 Prints info about a transaction.
-Acquires and releases lock_sys->mutex and trx_sys->lock. */
+Acquires and releases lock_sys->mutex and trx_sys->mutex. */
 UNIV_INTERN
 void
 trx_print(
@@ -1460,16 +1454,16 @@ trx_print(
 	heap_size = mem_heap_get_size(trx->lock.lock_heap);
 	lock_mutex_exit();
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 	trx_print_low(f, trx, max_query_len,
 		      n_lock_rec, n_lock_struct, heap_size);
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 }
 
 #ifdef UNIV_DEBUG
 /**********************************************************************//**
 Asserts that a transaction has been started.
-The caller must hold trx_sys->lock.
+The caller must hold trx_sys->mutex.
 @return TRUE if started */
 UNIV_INTERN
 ibool
@@ -1477,12 +1471,10 @@ trx_assert_started(
 /*===============*/
 	const trx_t*	trx)	/*!< in: transaction */
 {
-# ifdef UNIV_SYNC_DEBUG
-	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
-# endif /* UNIV_SYNC_DEBUG */
+	ut_ad(mutex_own(&trx_sys->mutex));
 
 	/* trx->state cannot change from or to NOT_STARTED while we
-	are holding trx_sys->lock. It may change from ACTIVE to
+	are holding trx_sys->mutex. It may change from ACTIVE to
 	PREPARED. Unless we are holding lock_sys->mutex, it may also
 	change to COMMITTED. */
 
@@ -1603,10 +1595,10 @@ trx_prepare(
 
 	/*--------------------------------------*/
 	ut_a(trx->state == TRX_STATE_ACTIVE);
-	rw_lock_x_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 	trx->state = TRX_STATE_PREPARED;
 	trx_sys->n_prepared_trx++;
-	rw_lock_x_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 	/*--------------------------------------*/
 
 	if (lsn) {
@@ -1689,14 +1681,14 @@ trx_recover_for_mysql(
 	/* We should set those transactions which are in the prepared state
 	to the xid_list */
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;
 	     trx = UT_LIST_GET_NEXT(trx_list, trx)) {
 
 		/* trx->state cannot change from or to NOT_STARTED
-		while we are holding the trx_sys->lock. It may change
+		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)) {
@@ -1729,7 +1721,7 @@ trx_recover_for_mysql(
 		}
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	if (count > 0){
 		ut_print_timestamp(stderr);
@@ -1761,7 +1753,7 @@ trx_get_trx_by_xid(
 		return(NULL);
 	}
 
-	rw_lock_s_lock(&trx_sys->lock);
+	mutex_enter(&trx_sys->mutex);
 
 	for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
 	     trx != NULL;
@@ -1787,7 +1779,7 @@ trx_get_trx_by_xid(
 		}
 	}
 
-	rw_lock_s_unlock(&trx_sys->lock);
+	mutex_exit(&trx_sys->mutex);
 
 	return(trx);
 }

=== modified file 'storage/innobase/trx/trx0undo.c'
--- a/storage/innobase/trx/trx0undo.c	2011-07-19 00:25:20 +0000
+++ b/storage/innobase/trx/trx0undo.c	2011-07-26 11:08:42 +0000
@@ -80,7 +80,7 @@ can still remove old versions from the b
    -------------------------------------------------------------------
 latches?
 -------
-The contention of the trx_sys_t:::lock should be minimized. When a transaction
+The contention of the trx_sys_t::mutex should be minimized. When a transaction
 does its first insert or modify in an index, an undo log is assigned for it.
 Then we must have an x-latch to the rollback segment header.
 	When the transaction does more modifys or rolls back, the undo log is

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (jonathan.perkin:3299 to 3305) Jonathan Perkin24 Sep