List:Commits« Previous MessageNext Message »
From:Timothy Smith Date:January 13 2009 10:58pm
Subject:bzr commit into mysql-6.0-bugteam branch (timothy.smith:2961)
View as plain text  
#At file:///data0/tsmith/bzr/bugteam/60/ based on revid:davi.arnaut@stripped

 2961 Timothy Smith	2009-01-13 [merge]
      Up-merge changes from 5.1-bugteam to 6.0-bugteam.  Changes include innodb
      snapshot 5.1-ss3603 and fix for Bug 35261.
modified:
  mysql-test/r/date_formats.result
  mysql-test/r/innodb-semi-consistent.result
  mysql-test/r/partition_innodb_semi_consistent.result
  mysql-test/t/date_formats.test
  mysql-test/t/innodb-semi-consistent-master.opt
  mysql-test/t/innodb-semi-consistent.test
  mysql-test/t/partition_innodb_semi_consistent.test
  storage/innobase/handler/ha_innodb.cc
  storage/innobase/include/data0type.ic
  storage/innobase/include/hash0hash.ic
  storage/innobase/include/row0mysql.h
  storage/innobase/include/srv0srv.h
  storage/innobase/row/row0mysql.c
  storage/innobase/row/row0sel.c
  storage/innobase/srv/srv0srv.c
  storage/innobase/trx/trx0trx.c
  storage/innobase/trx/trx0undo.c

=== modified file 'mysql-test/r/date_formats.result'
--- a/mysql-test/r/date_formats.result	2009-01-09 13:36:06 +0000
+++ b/mysql-test/r/date_formats.result	2009-01-13 22:53:29 +0000
@@ -1,14 +1,20 @@
 drop table if exists t1;
-SHOW GLOBAL VARIABLES LIKE "%e_format";
-Variable_name	Value
-date_format	%d.%m.%Y
-datetime_format	%Y-%m-%d %H:%i:%s
-time_format	%H.%i.%s
-SHOW SESSION VARIABLES LIKE "%e_format";
-Variable_name	Value
-date_format	%d.%m.%Y
-datetime_format	%Y-%m-%d %H:%i:%s
-time_format	%H.%i.%s
+SELECT variable_name, variable_value
+FROM information_schema.global_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+variable_name	variable_value
+DATETIME_FORMAT	%Y-%m-%d %H:%i:%s
+DATE_FORMAT	%d.%m.%Y
+TIME_FORMAT	%H.%i.%s
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+variable_name	variable_value
+DATETIME_FORMAT	%Y-%m-%d %H:%i:%s
+DATE_FORMAT	%d.%m.%Y
+TIME_FORMAT	%H.%i.%s
 SET time_format='%H%i%s';
 SET time_format='%H:%i:%s.%f';
 SET time_format='%h-%i-%s.%f%p';
@@ -26,11 +32,14 @@ set datetime_format= '%H:%i:%s %Y-%m-%d'
 set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
 set datetime_format= '%h:%i:%s %p %Y-%m-%d';
 set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
-SHOW SESSION VARIABLES LIKE "%e_format";
-Variable_name	Value
-date_format	%m-%d-%Y
-datetime_format	%h:%i:%s.%f %p %Y-%m-%d
-time_format	%h:%i:%s%p
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+variable_name	variable_value
+DATETIME_FORMAT	%h:%i:%s.%f %p %Y-%m-%d
+DATE_FORMAT	%m-%d-%Y
+TIME_FORMAT	%h:%i:%s%p
 SET time_format='%h:%i:%s';
 ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
 SET time_format='%H %i:%s';

=== modified file 'mysql-test/r/innodb-semi-consistent.result'
--- a/mysql-test/r/innodb-semi-consistent.result	2008-10-03 12:24:19 +0000
+++ b/mysql-test/r/innodb-semi-consistent.result	2009-01-13 14:14:11 +0000
@@ -1,6 +1,6 @@
 drop table if exists t1;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
 insert into t1 values (1),(2),(3),(4),(5),(6),(7);
 set autocommit=0;
@@ -8,11 +8,12 @@ select * from t1 where a=3 lock in share
 a
 3
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 set autocommit=0;
 update t1 set a=10 where a=5;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 commit;
+set session transaction isolation level read committed;
 update t1 set a=10 where a=5;
 select * from t1 where a=2 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction

=== modified file 'mysql-test/r/partition_innodb_semi_consistent.result'
--- a/mysql-test/r/partition_innodb_semi_consistent.result	2008-12-16 11:44:18 +0000
+++ b/mysql-test/r/partition_innodb_semi_consistent.result	2009-01-13 22:12:16 +0000
@@ -1,6 +1,6 @@
 drop table if exists t1;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 create table t1(a int not null)
 engine=innodb
 DEFAULT CHARSET=latin1
@@ -13,11 +13,12 @@ select * from t1 where a=3 lock in share
 a
 3
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 set autocommit=0;
 update t1 set a=10 where a=5;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 commit;
+set session transaction isolation level read committed;
 update t1 set a=10 where a=5;
 select * from t1 where a=2 for update;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction

=== modified file 'mysql-test/t/date_formats.test'
--- a/mysql-test/t/date_formats.test	2009-01-09 13:22:15 +0000
+++ b/mysql-test/t/date_formats.test	2009-01-13 22:29:11 +0000
@@ -6,10 +6,15 @@
 drop table if exists t1;
 --enable_warnings
 
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW GLOBAL VARIABLES LIKE "%e_format";
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW SESSION VARIABLES LIKE "%e_format";
+SELECT variable_name, variable_value
+FROM information_schema.global_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
 
 #
 # Test setting a lot of different formats to see which formats are accepted and
@@ -36,8 +41,10 @@ set datetime_format= '%H:%i:%s.%f %m-%d-
 set datetime_format= '%h:%i:%s %p %Y-%m-%d';
 set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
 
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW SESSION VARIABLES LIKE "%e_format";
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
 
 --error 1231
 SET time_format='%h:%i:%s';
@@ -121,7 +128,7 @@ SET datetime_format=default;
 # Test of str_to_date
 #
 
-# PS doesn't support fraction of a seconds
+# PS doesn't support fractions of a second
 --disable_ps_protocol
 select str_to_date(concat('15-01-2001',' 2:59:58.999'),
 	           concat('%d-%m-%Y',' ','%H:%i:%s.%f'));

=== modified file 'mysql-test/t/innodb-semi-consistent-master.opt'
--- a/mysql-test/t/innodb-semi-consistent-master.opt	2007-11-06 22:42:58 +0000
+++ b/mysql-test/t/innodb-semi-consistent-master.opt	2009-01-13 14:14:11 +0000
@@ -1 +1 @@
---innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2

=== modified file 'mysql-test/t/innodb-semi-consistent.test'
--- a/mysql-test/t/innodb-semi-consistent.test	2008-10-03 12:24:19 +0000
+++ b/mysql-test/t/innodb-semi-consistent.test	2009-01-13 14:14:11 +0000
@@ -11,7 +11,7 @@ connect (a,localhost,root,,);
 connect (b,localhost,root,,);
 connection a;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
 insert into t1 values (1),(2),(3),(4),(5),(6),(7);
 set autocommit=0;
@@ -19,13 +19,15 @@ set autocommit=0;
 select * from t1 where a=3 lock in share mode;
 connection b;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 set autocommit=0;
 -- error ER_LOCK_WAIT_TIMEOUT
 update t1 set a=10 where a=5;
 connection a;
 commit;
 connection b;
+# perform a semi-consisent read (and unlock non-matching rows)
+set session transaction isolation level read committed;
 update t1 set a=10 where a=5;
 connection a;
 -- error ER_LOCK_WAIT_TIMEOUT
@@ -33,6 +35,7 @@ select * from t1 where a=2 for update;
 # this should lock the records (1),(2)
 select * from t1 where a=2 limit 1 for update;
 connection b;
+# semi-consistent read will skip non-matching locked rows a=1, a=2
 update t1 set a=11 where a=6;
 -- error ER_LOCK_WAIT_TIMEOUT
 update t1 set a=12 where a=2;

=== modified file 'mysql-test/t/partition_innodb_semi_consistent.test'
--- a/mysql-test/t/partition_innodb_semi_consistent.test	2008-12-16 11:44:18 +0000
+++ b/mysql-test/t/partition_innodb_semi_consistent.test	2009-01-13 22:12:16 +0000
@@ -14,7 +14,7 @@ connect (a,localhost,root,,);
 connect (b,localhost,root,,);
 connection a;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 create table t1(a int not null)
 engine=innodb
 DEFAULT CHARSET=latin1
@@ -27,7 +27,7 @@ set autocommit=0;
 select * from t1 where a=3 lock in share mode;
 connection b;
 set binlog_format=mixed;
-set session transaction isolation level read committed;
+set session transaction isolation level repeatable read;
 set autocommit=0;
 -- error ER_LOCK_WAIT_TIMEOUT
 update t1 set a=10 where a=5;
@@ -35,6 +35,8 @@ connection a;
 #DELETE FROM t1 WHERE a=5;
 commit;
 connection b;
+# perform a semi-consisent read (and unlock non-matching rows)
+set session transaction isolation level read committed;
 update t1 set a=10 where a=5;
 connection a;
 -- error ER_LOCK_WAIT_TIMEOUT
@@ -42,6 +44,7 @@ select * from t1 where a=2 for update;
 # this should lock the records (1),(2)
 select * from t1 where a=2 limit 1 for update;
 connection b;
+# semi-consistent read will skip non-matching locked rows a=1, a=2
 update t1 set a=11 where a=6;
 -- error ER_LOCK_WAIT_TIMEOUT
 update t1 set a=12 where a=2;

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-01-12 05:57:14 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-01-13 22:53:29 +0000
@@ -134,7 +134,7 @@ static my_bool	innobase_file_per_table		
 static my_bool	innobase_locks_unsafe_for_binlog	= FALSE;
 static my_bool	innobase_rollback_on_timeout		= FALSE;
 static my_bool	innobase_create_status_file		= FALSE;
-static my_bool innobase_stats_on_metadata		= TRUE;
+static my_bool	innobase_stats_on_metadata		= TRUE;
 static my_bool	innobase_adaptive_hash_index	= TRUE;
 
 static char*	internal_innobase_data_file_path	= NULL;
@@ -467,7 +467,7 @@ innodb_srv_conc_exit_innodb(
 /*========================*/
 	trx_t*	trx)	/* in: transaction handle */
 {
-	if (UNIV_LIKELY(!srv_thread_concurrency)) {
+	if (UNIV_LIKELY(!trx->declared_to_be_inside_innodb)) {
 
 		return;
 	}
@@ -1745,8 +1745,6 @@ innobase_init(
 	srv_max_n_open_files = (ulint) innobase_open_files;
 	srv_innodb_status = (ibool) innobase_create_status_file;
 
-	srv_stats_on_metadata = (ibool) innobase_stats_on_metadata;
-
 	srv_use_adaptive_hash_indexes =
 		(ibool) innobase_adaptive_hash_index;
 
@@ -2549,7 +2547,8 @@ retry:
 	prebuilt = row_create_prebuilt(ib_table);
 
 	prebuilt->mysql_row_len = table->s->reclength;
-        prebuilt->idx_cond_func= NULL;
+	prebuilt->default_rec = table->s->default_values;
+	ut_ad(prebuilt->default_rec);
 
 	/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
 
@@ -4211,7 +4210,8 @@ ha_innobase::unlock_row(void)
 	switch (prebuilt->row_read_type) {
 	case ROW_READ_WITH_LOCKS:
 		if (!srv_locks_unsafe_for_binlog
-		|| prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+		    && prebuilt->trx->isolation_level
+		    != TRX_ISO_READ_COMMITTED) {
 			break;
 		}
 		/* fall through */
@@ -6045,7 +6045,7 @@ ha_innobase::info(
 	ib_table = prebuilt->table;
 
 	if (flag & HA_STATUS_TIME) {
-		if (srv_stats_on_metadata) {
+		if (innobase_stats_on_metadata) {
 			/* In sql_show we call with this flag: update
 			then statistics so that they are up-to-date */
 
@@ -6093,11 +6093,13 @@ ha_innobase::info(
 			n_rows++;
 		}
 
-		/* Fix bug#29507: TRUNCATE shows too many rows affected.
-		Do not show the estimates for TRUNCATE command. */
+		/* Fix bug#40386: Not flushing query cache after truncate.
+		n_rows can not be 0 unless the table is empty, set to 1
+		instead. The original problem of bug#29507 is actually
+		fixed in the server code. */
 		if (thd_sql_command(user_thd) == SQLCOM_TRUNCATE) {
 
-			n_rows = 0;
+			n_rows = 1;
 
 			/* We need to reset the prebuilt value too, otherwise
 			checks for values greater than the last value written
@@ -8318,7 +8320,7 @@ static MYSQL_SYSVAR_BOOL(status_file, in
   NULL, NULL, FALSE);
 
 static MYSQL_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
-  PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
+  PLUGIN_VAR_OPCMDARG,
   "Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
   NULL, NULL, TRUE);
 

=== modified file 'storage/innobase/include/data0type.ic'
--- a/storage/innobase/include/data0type.ic	2007-01-05 02:51:34 +0000
+++ b/storage/innobase/include/data0type.ic	2009-01-12 22:27:11 +0000
@@ -558,5 +558,5 @@ dtype_get_sql_null_size(
 	const dtype_t*	type)	/* in: type */
 {
 	return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len,
-					type->mbminlen, type->mbmaxlen) > 0);
+					type->mbminlen, type->mbmaxlen));
 }

=== modified file 'storage/innobase/include/hash0hash.ic'
--- a/storage/innobase/include/hash0hash.ic	2006-03-10 16:22:21 +0000
+++ b/storage/innobase/include/hash0hash.ic	2009-01-12 22:32:50 +0000
@@ -58,7 +58,8 @@ hash_get_mutex_no(
 	hash_table_t*	table,	/* in: hash table */
 	ulint		fold)	/* in: fold */
 {
-	return(ut_2pow_remainder(fold, table->n_mutexes));
+	return(ut_2pow_remainder(hash_calc_hash(fold, table),
+				 table->n_mutexes));
 }
 
 /****************************************************************

=== modified file 'storage/innobase/include/row0mysql.h'
--- a/storage/innobase/include/row0mysql.h	2008-12-19 00:34:15 +0000
+++ b/storage/innobase/include/row0mysql.h	2009-01-13 22:53:29 +0000
@@ -596,6 +596,8 @@ struct row_prebuilt_struct {
 	byte*		ins_upd_rec_buff;/* buffer for storing data converted
 					to the Innobase format from the MySQL
 					format */
+	const byte*	default_rec;	/* the default values of all columns
+					(a "default row") in MySQL format */
 	ulint		hint_need_to_fetch_extra_cols;
 					/* normally this is set to 0; if this
 					is set to ROW_RETRIEVE_PRIMARY_KEY,

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	2008-10-15 22:53:18 +0000
+++ b/storage/innobase/include/srv0srv.h	2009-01-13 22:53:29 +0000
@@ -124,8 +124,6 @@ extern ulint	srv_fast_shutdown;	 /* If t
 					 transactions). */
 extern ibool	srv_innodb_status;
 
-extern ibool	srv_stats_on_metadata;
-
 extern ibool	srv_use_doublewrite_buf;
 extern ibool	srv_use_checksums;
 

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	2008-12-19 00:34:15 +0000
+++ b/storage/innobase/row/row0mysql.c	2009-01-13 22:53:29 +0000
@@ -342,7 +342,7 @@ row_mysql_store_col_in_innobase_format(
 		/* In some cases we strip trailing spaces from UTF-8 and other
 		multibyte charsets, from FIXED-length CHAR columns, to save
 		space. UTF-8 would otherwise normally use 3 * the string length
-		bytes to store a latin1 string! */
+		bytes to store an ASCII string! */
 
 		/* We assume that this CHAR field is encoded in a
 		variable-length character set where spaces have
@@ -620,6 +620,7 @@ row_create_prebuilt(
 	prebuilt->ins_node = NULL;
 
 	prebuilt->ins_upd_rec_buff = NULL;
+	prebuilt->default_rec = NULL;
 
 	prebuilt->upd_node = NULL;
 	prebuilt->ins_graph = NULL;
@@ -1485,12 +1486,13 @@ row_unlock_for_mysql(
 	ut_ad(prebuilt && trx);
 	ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
 
-	if (!(srv_locks_unsafe_for_binlog
-	      || trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
+	if (UNIV_UNLIKELY
+	    (!srv_locks_unsafe_for_binlog
+	     && trx->isolation_level != TRX_ISO_READ_COMMITTED)) {
 
 		fprintf(stderr,
 			"InnoDB: Error: calling row_unlock_for_mysql though\n"
-			"InnoDB: srv_locks_unsafe_for_binlog is FALSE and\n"
+			"InnoDB: innodb_locks_unsafe_for_binlog is FALSE and\n"
 			"InnoDB: this session is not using"
 			" READ COMMITTED isolation level.\n");
 

=== modified file 'storage/innobase/row/row0sel.c'
--- a/storage/innobase/row/row0sel.c	2008-12-19 00:34:15 +0000
+++ b/storage/innobase/row/row0sel.c	2009-01-13 22:53:29 +0000
@@ -2599,6 +2599,7 @@ row_sel_store_mysql_rec(
 	ulint			i;
 
 	ut_ad(prebuilt->mysql_template);
+	ut_ad(prebuilt->default_rec);
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
 
 	if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
@@ -2685,58 +2686,14 @@ row_sel_store_mysql_rec(
 					&= ~(byte) templ->mysql_null_bit_mask;
 			}
 		} else {
-			/* MySQL seems to assume the field for an SQL NULL
-			value is set to zero or space. Not taking this into
-			account caused seg faults with NULL BLOB fields, and
-			bug number 154 in the MySQL bug database: GROUP BY
-			and DISTINCT could treat NULL values inequal. */
-			int	pad_char;
+			/* MySQL assumes that the field for an SQL
+			NULL value is set to the default value. */
 
 			mysql_rec[templ->mysql_null_byte_offset]
 				|= (byte) templ->mysql_null_bit_mask;
-			switch (templ->type) {
-			case DATA_VARCHAR:
-			case DATA_BINARY:
-			case DATA_VARMYSQL:
-				if (templ->mysql_type
-				    == DATA_MYSQL_TRUE_VARCHAR) {
-					/* This is a >= 5.0.3 type
-					true VARCHAR.  Zero the field. */
-					pad_char = 0x00;
-					break;
-				}
-				/* Fall through */
-			case DATA_CHAR:
-			case DATA_FIXBINARY:
-			case DATA_MYSQL:
-				/* MySQL pads all string types (except
-				BLOB, TEXT and true VARCHAR) with space. */
-				if (UNIV_UNLIKELY(templ->mbminlen == 2)) {
-					/* Treat UCS2 as a special case. */
-					data = mysql_rec
-						+ templ->mysql_col_offset;
-					len = templ->mysql_col_len;
-					/* There are two UCS2 bytes per char,
-					so the length has to be even. */
-					ut_a(!(len & 1));
-					/* Pad with 0x0020. */
-					while (len) {
-						*data++ = 0x00;
-						*data++ = 0x20;
-						len -= 2;
-					}
-					continue;
-				}
-				pad_char = 0x20;
-				break;
-			default:
-				pad_char = 0x00;
-				break;
-			}
-
-			ut_ad(!pad_char || templ->mbminlen == 1);
-			memset(mysql_rec + templ->mysql_col_offset,
-			       pad_char, templ->mysql_col_len);
+			memcpy(mysql_rec + templ->mysql_col_offset,
+			       prebuilt->default_rec + templ->mysql_col_offset,
+			       templ->mysql_col_len);
 		}
 	}
 

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2008-12-19 00:34:15 +0000
+++ b/storage/innobase/srv/srv0srv.c	2009-01-13 22:53:29 +0000
@@ -283,13 +283,16 @@ ulong	srv_commit_concurrency	= 0;
 
 os_fast_mutex_t	srv_conc_mutex;		/* this mutex protects srv_conc data
 					structures */
-lint	srv_conc_n_threads	= 0;	/* number of OS threads currently
-					inside InnoDB; it is not an error
-					if this drops temporarily below zero
-					because we do not demand that every
-					thread increments this, but a thread
-					waiting for a lock decrements this
-					temporarily */
+lint	srv_conc_n_threads	= 0;	/* number of transactions that
+					have declared_to_be_inside_innodb
+					set. It used to be a non-error
+					for this value to drop below
+					zero temporarily. This is no
+					longer true. We'll, however,
+					keep the lint datatype to add
+					assertions to catch any corner
+					cases that we may have
+					missed. */
 ulint	srv_conc_n_waiting_threads = 0;	/* number of OS threads waiting in the
 					FIFO for a permission to enter InnoDB
 					*/
@@ -328,8 +331,6 @@ ulint	srv_fast_shutdown	= 0;
 /* Generate a innodb_status.<pid> file */
 ibool	srv_innodb_status	= FALSE;
 
-ibool	srv_stats_on_metadata	= TRUE;
-
 ibool	srv_use_doublewrite_buf	= TRUE;
 ibool	srv_use_checksums = TRUE;
 
@@ -1019,6 +1020,8 @@ retry:
 		return;
 	}
 
+	ut_ad(srv_conc_n_threads >= 0);
+
 	if (srv_conc_n_threads < (lint)srv_thread_concurrency) {
 
 		srv_conc_n_threads++;
@@ -1145,6 +1148,8 @@ srv_conc_force_enter_innodb(
 		return;
 	}
 
+	ut_ad(srv_conc_n_threads >= 0);
+
 	os_fast_mutex_lock(&srv_conc_mutex);
 
 	srv_conc_n_threads++;
@@ -1166,11 +1171,6 @@ srv_conc_force_exit_innodb(
 {
 	srv_conc_slot_t*	slot	= NULL;
 
-	if (UNIV_LIKELY(!srv_thread_concurrency)) {
-
-		return;
-	}
-
 	if (trx->mysql_thd != NULL
 	    && thd_is_replication_slave_thread(trx->mysql_thd)) {
 
@@ -1184,6 +1184,7 @@ srv_conc_force_exit_innodb(
 
 	os_fast_mutex_lock(&srv_conc_mutex);
 
+	ut_ad(srv_conc_n_threads > 0);
 	srv_conc_n_threads--;
 	trx->declared_to_be_inside_innodb = FALSE;
 	trx->n_tickets_to_enter_innodb = 0;

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	2008-08-19 14:14:18 +0000
+++ b/storage/innobase/trx/trx0trx.c	2009-01-13 22:53:29 +0000
@@ -287,6 +287,10 @@ trx_free(
 		      "InnoDB: inside InnoDB.\n", stderr);
 		trx_print(stderr, trx, 600);
 		putc('\n', stderr);
+
+		/* This is an error but not a fatal error. We must keep
+		the counters like srv_conc_n_threads accurate. */
+		srv_conc_force_exit_innodb(trx);
 	}
 
 	if (trx->n_mysql_tables_in_use != 0

=== modified file 'storage/innobase/trx/trx0undo.c'
--- a/storage/innobase/trx/trx0undo.c	2008-08-19 14:14:18 +0000
+++ b/storage/innobase/trx/trx0undo.c	2009-01-13 22:53:29 +0000
@@ -410,7 +410,7 @@ trx_undo_seg_create(
 	if (slot_no == ULINT_UNDEFINED) {
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
-			"InnoDB: Warning: cannot find a free slot for"
+			"  InnoDB: Warning: cannot find a free slot for"
 			" an undo log. Do you have too\n"
 			"InnoDB: many active transactions"
 			" running concurrently?\n");

Thread
bzr commit into mysql-6.0-bugteam branch (timothy.smith:2961) Timothy Smith13 Jan