List:Commits« Previous MessageNext Message »
From:Marc Alff Date:June 4 2012 2:13pm
Subject:bzr push into mysql-trunk-wl6135 branch (marc.alff:3801 to 3802)
View as plain text  
 3802 Marc Alff	2012-06-04 [merge]
      Merge mysql-trunk --> mysql-trunk-wl6135

    modified:
      mysql-test/include/mix1.inc
      mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
      mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
      mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
      mysql-test/suite/perfschema/t/sizing_default.test
      mysql-test/suite/perfschema/t/sizing_high.test
      mysql-test/suite/perfschema/t/sizing_low.test
      mysql-test/suite/perfschema/t/sizing_med.test
      mysql-test/t/mysqldump.test
      sql/binlog.cc
      sql/ha_ndbcluster.cc
      sql/mysqld.h
      sql/sql_class.h
      sql/sql_parse.cc
      sql/sql_select.cc
      storage/innobase/dict/dict0stats.cc
      storage/innobase/dict/dict0stats_background.cc
      storage/innobase/fts/fts0fts.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/dict0stats_background.h
      storage/innobase/include/sync0sync.h
      storage/innobase/row/row0mysql.cc
      storage/innobase/sync/sync0sync.cc
 3801 Marc Alff	2012-06-01
      Fixed test result

    modified:
      mysql-test/suite/perfschema/r/sizing_off.result
=== modified file 'mysql-test/include/mix1.inc'
--- a/mysql-test/include/mix1.inc	2012-05-23 13:34:33 +0000
+++ b/mysql-test/include/mix1.inc	2012-06-01 13:39:23 +0000
@@ -1626,6 +1626,13 @@ CREATE TABLE t2 (
 insert into t1 values (0),(1),(2),(3),(4);
 insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
 
+-- disable_query_log
+-- disable_result_log
+analyze table t1;
+analyze table t2;
+-- enable_result_log
+-- enable_query_log
+
 explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
 select * from t1, t2 where t2.a=t1.a and t2.b + 1;
 

=== modified file 'mysql-test/suite/innodb/r/innodb_stats_drop_locked.result'
--- a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result	2012-05-10 12:43:57 +0000
+++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result	2012-06-01 12:57:36 +0000
@@ -26,8 +26,6 @@ innodb_stats_drop_locked	CREATE TABLE `i
   `c` int(11) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
 DROP TABLE innodb_stats_drop_locked;
-Warnings:
-Warning	1205	Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name = 'test' AND table_name = 'innodb_stats_drop_locked'; DELETE FROM mysql.innodb_table_stats WHERE database_name = 'test' AND table_name = 'innodb_stats_drop_locked';
 SHOW TABLES;
 Tables_in_test
 COMMIT;

=== modified file 'mysql-test/suite/innodb_fts/r/innodb_fts_misc.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	2012-05-18 15:37:37 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	2012-06-01 15:24:42 +0000
@@ -1138,3 +1138,53 @@ FTS_DOC_ID	x
 2	0
 3	0
 DROP TABLE t1;
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO `t2` VALUES();
+COMMIT WORK AND CHAIN;
+INSERT  INTO `t3` VALUES ();
+UPDATE  `t2` SET `b` = 'a';
+SAVEPOINT BATCH1;
+DROP TABLE t2;
+DROP TABLE t3;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+COMMIT WORK AND CHAIN;
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SAVEPOINT BATCH1;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+1
+2
+3
+INSERT INTO t1 (a,b) VALUES
+('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+ROLLBACK TO SAVEPOINT BATCH1;
+COMMIT;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+6
+1
+2
+3
+4
+5
+DROP TABLE t1;

=== modified file 'mysql-test/suite/innodb_fts/t/innodb_fts_misc.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	2012-05-18 15:37:37 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	2012-06-01 15:24:42 +0000
@@ -1058,3 +1058,65 @@ select FTS_DOC_ID from t1 where MATCH(a,
 select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
 
 DROP TABLE t1;
+
+# Test for bug #14079609 - FTS: CRASH IN FTS_TRX_TABLE_CMP WITH SAVEPOINTS, XA
+
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+
+CREATE TABLE t3 LIKE t2;
+
+INSERT INTO `t2` VALUES();
+
+COMMIT WORK AND CHAIN;
+
+INSERT  INTO `t3` VALUES ();
+UPDATE  `t2` SET `b` = 'a';
+
+SAVEPOINT BATCH1;
+
+DROP TABLE t2;
+DROP TABLE t3;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+COMMIT WORK AND CHAIN;
+
+INSERT INTO t1 (a,b) VALUES
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+SAVEPOINT BATCH1;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+INSERT INTO t1 (a,b) VALUES
+        ('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+
+ROLLBACK TO SAVEPOINT BATCH1;
+
+COMMIT;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE t1;

=== modified file 'mysql-test/suite/perfschema/t/sizing_default.test'
--- a/mysql-test/suite/perfschema/t/sizing_default.test	2012-05-30 23:04:50 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_default.test	2012-06-04 14:12:37 +0000
@@ -2,6 +2,7 @@
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
 --source include/have_64bit.inc
+--source include/not_valgrind.inc
 --source ../include/have_aligned_memory.inc
 
 --source ../include/sizing_auto.inc

=== modified file 'mysql-test/suite/perfschema/t/sizing_high.test'
--- a/mysql-test/suite/perfschema/t/sizing_high.test	2012-05-30 23:04:50 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_high.test	2012-06-04 14:12:37 +0000
@@ -2,6 +2,7 @@
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
 --source include/have_64bit.inc
+--source include/not_valgrind.inc
 --source ../include/have_aligned_memory.inc
 
 --source ../include/sizing_auto.inc

=== modified file 'mysql-test/suite/perfschema/t/sizing_low.test'
--- a/mysql-test/suite/perfschema/t/sizing_low.test	2012-05-30 23:04:50 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_low.test	2012-06-04 14:12:37 +0000
@@ -2,6 +2,7 @@
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
 --source include/have_64bit.inc
+--source include/not_valgrind.inc
 --source ../include/have_aligned_memory.inc
 
 --source ../include/sizing_auto.inc

=== modified file 'mysql-test/suite/perfschema/t/sizing_med.test'
--- a/mysql-test/suite/perfschema/t/sizing_med.test	2012-05-30 23:04:50 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_med.test	2012-06-04 14:12:37 +0000
@@ -2,6 +2,7 @@
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
 --source include/have_64bit.inc
+--source include/not_valgrind.inc
 --source ../include/have_aligned_memory.inc
 
 --source ../include/sizing_auto.inc

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2012-05-09 16:53:03 +0000
+++ b/mysql-test/t/mysqldump.test	2012-06-01 12:57:36 +0000
@@ -9,6 +9,7 @@
 
 disable_query_log;
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("InnoDB: Error: Table .*innodb_(table|index)_stats.* not found");
 enable_query_log;
 
 --echo # Bug#37938 Test "mysqldump" lacks various insert statements

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2012-05-30 11:38:39 +0000
+++ b/sql/binlog.cc	2012-06-04 11:41:25 +0000
@@ -4467,7 +4467,7 @@ bool MYSQL_BIN_LOG::flush_and_sync(const
   if (flush_io_cache(&log_file))
     return 1;
 
-  std::pair<bool, bool> result= sync_binlog_file(true);
+  std::pair<bool, bool> result= sync_binlog_file(force);
 
   return result.first;
 }

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2012-05-22 09:03:56 +0000
+++ b/sql/ha_ndbcluster.cc	2012-06-01 11:03:09 +0000
@@ -7530,7 +7530,7 @@ static void transaction_checks(THD *thd,
 {
   if (thd->lex->sql_command == SQLCOM_LOAD)
     thd_ndb->trans_options|= TNTO_TRANSACTIONS_OFF;
-  else if (!thd->transaction.on)
+  else if (!thd->transaction.flags.enabled)
     thd_ndb->trans_options|= TNTO_TRANSACTIONS_OFF;
   else if (!THDVAR(thd, use_transactions))
     thd_ndb->trans_options|= TNTO_TRANSACTIONS_OFF;

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2012-05-31 11:14:10 +0000
+++ b/sql/mysqld.h	2012-06-04 14:12:37 +0000
@@ -652,7 +652,7 @@ extern my_atomic_rwlock_t global_query_i
 void unireg_end(void) __attribute__((noreturn));
 
 /* increment query_id and return it.  */
-inline query_id_t next_query_id()
+inline __attribute__((warn_unused_result)) query_id_t next_query_id()
 {
   query_id_t id;
   my_atomic_rwlock_wrlock(&global_query_id_lock);
@@ -661,16 +661,6 @@ inline query_id_t next_query_id()
   return (id+1);
 }
 
-inline query_id_t get_query_id()
-{
-  query_id_t id;
-  my_atomic_rwlock_wrlock(&global_query_id_lock);
-  id= my_atomic_load64(&global_query_id);
-  my_atomic_rwlock_wrunlock(&global_query_id_lock);
-  return id;
-}
-
-
 /*
   TODO: Replace this with an inline function.
  */

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2012-05-31 16:21:37 +0000
+++ b/sql/sql_class.h	2012-06-04 04:50:38 +0000
@@ -4808,7 +4808,9 @@ public:
 /**
   Skip the increase of the global query id counter. Commonly set for
   commands that are stateless (won't cause any change on the server
-  internal states).
+  internal states). This is made obsolete as query id is incremented 
+  for ping and statistics commands as well because of race condition 
+  (Bug#58785).
 */
 #define CF_SKIP_QUERY_ID        (1U << 0)
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2012-05-29 11:22:15 +0000
+++ b/sql/sql_parse.cc	2012-06-04 04:50:38 +0000
@@ -294,8 +294,8 @@ void init_update_queries(void)
   /* Initialize the server command flags array. */
   memset(server_command_flags, 0, sizeof(server_command_flags));
 
-  server_command_flags[COM_STATISTICS]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS;
-  server_command_flags[COM_PING]=       CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS;
+  server_command_flags[COM_STATISTICS]= CF_SKIP_QUESTIONS;
+  server_command_flags[COM_PING]=       CF_SKIP_QUESTIONS;
   server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS;
   server_command_flags[COM_STMT_CLOSE]=   CF_SKIP_QUESTIONS;
   server_command_flags[COM_STMT_RESET]=   CF_SKIP_QUESTIONS;
@@ -1173,9 +1173,7 @@ bool dispatch_command(enum enum_server_c
     thd->security_ctx->master_access|= SHUTDOWN_ACL;
     command= COM_SHUTDOWN;
   }
-  thd->set_query_id(get_query_id());
-  if (!(server_command_flags[command] & CF_SKIP_QUERY_ID))
-    next_query_id();
+  thd->set_query_id(next_query_id());
   inc_thread_running();
 
   if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2012-06-01 06:21:44 +0000
+++ b/sql/sql_select.cc	2012-06-01 15:21:41 +0000
@@ -5109,6 +5109,7 @@ bool JOIN::make_tmp_tables_info()
   if (join_tab)
     join_tab[tables + tmp_tables - 1].next_select=
       setup_end_select_func(this, NULL);
+  group= has_group_by;
 
   DBUG_RETURN(false);
 }

=== modified file 'storage/innobase/dict/dict0stats.cc'
--- a/storage/innobase/dict/dict0stats.cc	2012-05-29 04:50:13 +0000
+++ b/storage/innobase/dict/dict0stats.cc	2012-06-01 12:57:36 +0000
@@ -3053,9 +3053,8 @@ dict_stats_drop_table(
 	char		database_name[MAX_DATABASE_NAME_LEN + 1];
 	const char*	table_name_strip; /* without leading db name */
 	dberr_t		ret;
-	dict_stats_t*	dict_stats;
 
-	ut_ad(!mutex_own(&dict_sys->mutex));
+	ut_ad(mutex_own(&dict_sys->mutex));
 
 	/* skip tables that do not contain a database name
 	e.g. if we are dropping SYS_TABLES */
@@ -3071,12 +3070,9 @@ dict_stats_drop_table(
 		return(DB_SUCCESS);
 	}
 
-	/* Increment table reference count to prevent the tables from
-	being DROPped just before que_eval_sql(). */
-	dict_stats = dict_stats_open();
-
-	if (dict_stats == NULL) {
-		/* stats tables do not exist or have unexpected structure */
+	if (!dict_stats_persistent_storage_check(TRUE)) {
+		/* If stats tables are gone, then there is nothing to
+		delete from them. */
 		return(DB_SUCCESS);
 	}
 
@@ -3086,8 +3082,6 @@ dict_stats_drop_table(
 
 	table_name_strip = dict_remove_db_name(table_name);
 
-	mutex_enter(&dict_sys->mutex);
-
 	ret = dict_stats_delete_from_table_stats(database_name,
 						 table_name_strip);
 
@@ -3096,8 +3090,6 @@ dict_stats_drop_table(
 							 table_name_strip);
 	}
 
-	mutex_exit(&dict_sys->mutex);
-
 	if (ret != DB_SUCCESS) {
 
 		ut_snprintf(errstr, errstr_sz,
@@ -3122,8 +3114,6 @@ dict_stats_drop_table(
 			    database_name, table_name_strip);
 	}
 
-	dict_stats_close(dict_stats);
-
 	return(ret);
 }
 /* @} */

=== modified file 'storage/innobase/dict/dict0stats_background.cc'
--- a/storage/innobase/dict/dict0stats_background.cc	2012-05-29 14:42:47 +0000
+++ b/storage/innobase/dict/dict0stats_background.cc	2012-06-01 12:57:36 +0000
@@ -153,20 +153,23 @@ dict_stats_dequeue_table_for_auto_recalc
 /* @} */
 
 /*****************************************************************//**
-Remove a table id from the auto recalc list. */
-static
+Remove a table from the auto recalc list.
+dict_stats_remove_table_from_auto_recalc() */
+UNIV_INTERN
 void
-dict_stats_remove_table_id(
-/*=======================*/
-	table_id_t	id)	/*!< in: table id to remove */
+dict_stats_remove_table_from_auto_recalc(
+/*=====================================*/
+	const dict_table_t*	table)	/*!< in: table to remove */
 {
-	ut_ad(mutex_own(&auto_recalc_mutex));
+	ut_ad(mutex_own(&dict_sys->mutex));
+
+	mutex_enter(&auto_recalc_mutex);
 
-	ut_ad(id > 0);
+	ut_ad(table->id > 0);
 
 	for (ulint i = 0; i < auto_recalc_used; ++i) {
 
-		if (auto_recalc_list[i] == id) {
+		if (auto_recalc_list[i] == table->id) {
 
 			ut_memmove(
 				&auto_recalc_list[i],
@@ -174,40 +177,11 @@ dict_stats_remove_table_id(
 				(auto_recalc_used - i - 1)
 				* sizeof(auto_recalc_list[0]));
 
-			--auto_recalc_used;
+			auto_recalc_used--;
 
 			break;
 		}
 	}
-}
-
-/*****************************************************************//**
-Remove a table from the auto recalc list.
-dict_stats_remove_table_from_auto_recalc() */
-UNIV_INTERN
-void
-dict_stats_remove_table_from_auto_recalc(
-/*=====================================*/
-	const char*	table_name)	/*!< in: table name, e.g. "db/table" */
-{
-	dict_table_t*	table;
-
-	table = dict_table_open_on_name(
-		table_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
-
-	if (table == NULL) {
-		return;
-	}
-
-	table_id_t	id = table->id;
-
-	dict_table_close(table, FALSE, FALSE);
-
-	mutex_enter(&auto_recalc_mutex);
-
-	dict_stats_remove_table_id(id);
-
-	ut_ad(auto_recalc_used <= auto_recalc_size);
 
 	mutex_exit(&auto_recalc_mutex);
 }
@@ -226,15 +200,20 @@ UNIV_INTERN
 void
 dict_stats_wait_bg_to_stop_using_tables(
 /*====================================*/
-	const dict_table_t*	table1,	/*!< in: table1 */
-	const dict_table_t*	table2,	/*!< in: table2, could be NULL */
-	trx_t*			trx)	/*!< in/out: transaction to use for
-					unlocking/locking the data dict */
+	dict_table_t*	table1,	/*!< in/out: table1 */
+	dict_table_t*	table2,	/*!< in/out: table2, could be NULL */
+	trx_t*		trx)	/*!< in/out: transaction to use for
+				unlocking/locking the data dict */
 {
 	while ((table1->stats_bg_flag & BG_STAT_IN_PROGRESS)
 	       || (table2 != NULL
 		   && (table2->stats_bg_flag & BG_STAT_IN_PROGRESS))) {
 
+		table1->stats_bg_flag |= BG_STAT_SHOULD_QUIT;
+		if (table2 != NULL) {
+			table2->stats_bg_flag |= BG_STAT_SHOULD_QUIT;
+		}
+
 		row_mysql_unlock_data_dictionary(trx);
 		os_thread_sleep(250000);
 		row_mysql_lock_data_dictionary(trx);
@@ -259,11 +238,15 @@ dict_stats_thread_init()
 	   any level would do here)
 	2) from row_update_statistics_if_needed()
 	   and released without latching anything else in between. We know
-	   that dict_sys->mutex (level SYNC_DICT) is not acquired when
+	   that dict_sys->mutex (SYNC_DICT) is not acquired when
 	   row_update_statistics_if_needed() is called and it may be acquired
-	   inside that function. So level SYNC_DICT is appropriate for
-	   auto_recalc_mutex. */
-	mutex_create(auto_recalc_mutex_key, &auto_recalc_mutex, SYNC_DICT);
+	   inside that function (thus a level <=SYNC_DICT would do).
+	3) from row_drop_table_for_mysql() after dict_sys->mutex (SYNC_DICT)
+	   and dict_operation_lock (SYNC_DICT_OPERATION) have been locked
+	   (thus a level <SYNC_DICT && <SYNC_DICT_OPERATION would do)
+	So we choose SYNC_STATS_AUTO_RECALC to be about below SYNC_DICT. */
+	mutex_create(auto_recalc_mutex_key, &auto_recalc_mutex,
+		     SYNC_STATS_AUTO_RECALC);
 
 	ut_ad(auto_recalc_list == NULL);
 

=== modified file 'storage/innobase/fts/fts0fts.cc'
--- a/storage/innobase/fts/fts0fts.cc	2012-04-26 00:15:26 +0000
+++ b/storage/innobase/fts/fts0fts.cc	2012-06-01 15:24:42 +0000
@@ -5228,7 +5228,7 @@ fts_savepoint_copy(
 
 		ftt_dst = fts_trx_table_clone(*ftt_src);
 
-		rbt_insert(dst->tables, &ftt_dst->table->id, &ftt_dst);
+		rbt_insert(dst->tables, &ftt_dst, &ftt_dst);
 	}
 }
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2012-06-01 07:33:02 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2012-06-01 12:57:36 +0000
@@ -9615,7 +9615,6 @@ ha_innobase::delete_table(
 	trx_t*	trx;
 	THD	*thd = ha_thd();
 	char	norm_name[1000];
-	char	errstr[1024];
 
 	DBUG_ENTER("ha_innobase::delete_table");
 
@@ -9636,21 +9635,6 @@ ha_innobase::delete_table(
 		DBUG_RETURN(HA_ERR_GENERIC);
 	}
 
-	dict_stats_remove_table_from_auto_recalc(norm_name);
-
-	/* Remove stats for this table and all of its indexes from the
-	persistent storage if it exists and if there are stats for this
-	table in there. This function creates its own trx and commits
-	it. */
-	error = dict_stats_drop_table(norm_name, errstr, sizeof(errstr));
-	if (error != DB_SUCCESS) {
-		ut_print_timestamp(stderr);
-		fprintf(stderr, " InnoDB: %s\n", errstr);
-
-		push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
-			     ER_LOCK_WAIT_TIMEOUT, errstr);
-	}
-
 	parent_trx = check_trx_exists(thd);
 
 	/* In case MySQL calls this in the middle of a SELECT query, release

=== modified file 'storage/innobase/include/dict0stats_background.h'
--- a/storage/innobase/include/dict0stats_background.h	2012-05-28 11:12:52 +0000
+++ b/storage/innobase/include/dict0stats_background.h	2012-06-01 12:57:36 +0000
@@ -56,7 +56,7 @@ UNIV_INTERN
 void
 dict_stats_remove_table_from_auto_recalc(
 /*=====================================*/
-	const char*	table_name);	/*!< in: table name, e.g. "db/table" */
+	const dict_table_t*	table);	/*!< in: table to remove */
 /* @} */
 
 /*****************************************************************//**
@@ -73,9 +73,10 @@ UNIV_INTERN
 void
 dict_stats_wait_bg_to_stop_using_tables(
 /*====================================*/
-	const dict_table_t*	table1,	/*!< in: table1 */
-	const dict_table_t*	table2,	/*!< in: table2, could be NULL */
-	trx_t*			trx);
+	dict_table_t*	table1,	/*!< in/out: table1 */
+	dict_table_t*	table2,	/*!< in/out: table2, could be NULL */
+	trx_t*		trx);	/*!< in/out: transaction to use for
+				unlocking/locking the data dict */
 /* @} */
 
 /*****************************************************************//**

=== modified file 'storage/innobase/include/sync0sync.h'
--- a/storage/innobase/include/sync0sync.h	2012-05-04 00:07:22 +0000
+++ b/storage/innobase/include/sync0sync.h	2012-06-01 12:57:36 +0000
@@ -665,6 +665,7 @@ or row lock! */
 #define SYNC_FTS_CACHE		1005	/* FTS cache rwlock */
 #define SYNC_DICT		1000
 #define SYNC_DICT_AUTOINC_MUTEX	999
+#define SYNC_STATS_AUTO_RECALC	997
 #define SYNC_DICT_HEADER	995
 #define SYNC_IBUF_HEADER	914
 #define SYNC_IBUF_PESS_INSERT_MUTEX 912

=== modified file 'storage/innobase/row/row0mysql.cc'
--- a/storage/innobase/row/row0mysql.cc	2012-05-29 04:50:13 +0000
+++ b/storage/innobase/row/row0mysql.cc	2012-06-01 15:24:42 +0000
@@ -3663,13 +3663,19 @@ retry:
 		}
 	}
 
-	/* Wait for background stats to finish using the table and
-	instruct it to do so earlier */
-	while (table->stats_bg_flag & BG_STAT_IN_PROGRESS) {
-		table->stats_bg_flag |= BG_STAT_SHOULD_QUIT;
-		row_mysql_unlock_data_dictionary(trx);
-		os_thread_sleep(250000);
-		row_mysql_lock_data_dictionary(trx);
+	dict_stats_wait_bg_to_stop_using_tables(table, NULL, trx);
+
+	dict_stats_remove_table_from_auto_recalc(table);
+
+	/* Remove stats for this table and all of its indexes from the
+	persistent storage if it exists and if there are stats for this
+	table in there. This function creates its own trx and commits
+	it. */
+	char	errstr[1024];
+	err = dict_stats_drop_table(name, errstr, sizeof(errstr));
+	if (err != DB_SUCCESS) {
+		ut_print_timestamp(stderr);
+		fprintf(stderr, " InnoDB: %s\n", errstr);
 	}
 
 	ut_a(table->n_foreign_key_checks_running == 0);
@@ -3962,7 +3968,13 @@ check_next_foreign:
 
 				goto funct_exit;
 			}
+		}
 
+		/* The table->fts flag can be set on the table for which
+		the cluster index is being rebuilt. Such table might not have
+		DICT_TF2_FTS flag set. So keep this out of above
+		dict_table_has_fts_index condition */
+		if (table->fts) {
 			fts_free(table);
 		}
 

=== modified file 'storage/innobase/sync/sync0sync.cc'
--- a/storage/innobase/sync/sync0sync.cc	2012-05-11 01:23:39 +0000
+++ b/storage/innobase/sync/sync0sync.cc	2012-06-01 12:57:36 +0000
@@ -1165,6 +1165,7 @@ sync_thread_add_level(
 	case SYNC_TRX_I_S_LAST_READ:
 	case SYNC_IBUF_MUTEX:
 	case SYNC_INDEX_ONLINE_LOG:
+	case SYNC_STATS_AUTO_RECALC:
 		if (!sync_thread_levels_g(array, level, TRUE)) {
 			fprintf(stderr,
 				"InnoDB: sync_thread_levels_g(array, %lu)"

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl6135 branch (marc.alff:3801 to 3802) Marc Alff4 Jun