List:Commits« Previous MessageNext Message »
From:kevin.lewis Date:June 15 2012 2:04pm
Subject:bzr push into mysql-trunk branch (kevin.lewis:4018 to 4019) Bug#14169459
View as plain text  
 4019 kevin.lewis@stripped	2012-06-15
      Bug #14169459 INNODB; DROP TABLE DOES NOT DELETE THE IBD FILE
      FOR A TEMPORARY TABLE.
      
      This patch has a number of changes. The main one to fix this problem
      is an extra test in row_drop_table_for_mysql() for '!temp' before
      calling fil_space_for_table_exists_in_mem() to check for 'unknown or
      discarded' tablespaces.
      
      The patch also adds the ibd extension to the temporary tablespace path
      before creating a fil_space_t.  This is how 5.5 does it.  
      
      Another change is in fil_delete_file(), a new function associated with
      the worklog 5522, where fil_make_cfg_name() and fil_make_ibt_name() are
      called with a tablename instead of a path as they should.
      This caused the function to not work at all for cfg and ibt files.
      Because of this, innodb-index-online.test was leaving a 't1.ibt' file
      behind in the data directory.  
      
      Also, in fil_delete_tablespace(), where it is called with rename=true,
      the logic was slightly wrong so that if an ibt file already existed, the
      code would fail to rename the ibd tablespace to the ibt extention.
      
      The function os_file_delete_if_exists() is improved so that if a directory
      does not exist on Windows, it behaves just a s if the file does not exist.
      
      Some related functions were changed to use bool instead of ibool.
      And row_drop_table_for_mysql() was cleaned up in its use of multiple
      tablename variables.

    added:
      mysql-test/suite/innodb/r/innodb_bug14169459.result
      mysql-test/suite/innodb/t/innodb_bug14169459.test
    modified:
      storage/innobase/fil/fil0fil.cc
      storage/innobase/include/fil0fil.h
      storage/innobase/include/os0file.h
      storage/innobase/os/os0file.cc
      storage/innobase/row/row0mysql.cc
      storage/innobase/srv/srv0start.cc
      storage/innobase/trx/trx0sys.cc
 4018 Dmitry Lenev	2012-06-15
      Fix for bug#14096759 "INPLACE ALTER, FIELD_FLAG FIELD_IN_ADD_INDEX HAS 
      BEEN REMOVED FROM SERVER".
      
      After WL@5534 "Online ALTER, Phase 1" has introduced new in-place ALTER
      TABLE API semantics of FIELD_IN_ADD_INDEX flag became unclear and thus
      this flag was removed from the code.
      
      It turns out that Cluster's implementation of Online ALTER still needs
      this flag as it allows to avoid extra iterations through keys list.
      
      This patch re-introduces this flag with a new, clearly defined 
      semantics:
      - it is now set for fields in TABLE object which correspond to 
        new version of altered table.
      - it is set for all fields which participate in newly added keys,
        including fields that exist in old version of table and fields 
        that were added by the same ALTER TABLE.

    modified:
      include/mysql_com.h
      sql/sql_table.cc
=== added file 'mysql-test/suite/innodb/r/innodb_bug14169459.result'
--- a/mysql-test/suite/innodb/r/innodb_bug14169459.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug14169459.result	revid:kevin.lewis@stripped
@@ -0,0 +1,56 @@
+SET default_storage_engine=InnoDB;
+SET GLOBAL innodb_file_per_table=ON;
+#
+# Create a temporary table and drop it.  Make sure the ibd file is gone.
+# Make sure a discarded table can be dropped with all files deleted.
+#
+CREATE TEMPORARY TABLE t14169459_1 (a INT, b TEXT) engine=InnoDB;
+CREATE TABLE t14169459_2 (a INT, b TEXT) engine=InnoDB;
+INSERT INTO t14169459_1 VALUES (1, 'one'),(2, 'two');
+INSERT INTO t14169459_2 VALUES (1, 'one'),(2, 'two');
+SELECT * FROM t14169459_1;
+a	b
+1	one
+2	two
+SELECT * FROM t14169459_2;
+a	b
+1	one
+2	two
+SHOW CREATE TABLE t14169459_1;
+Table	Create Table
+t14169459_1	CREATE TEMPORARY TABLE `t14169459_1` (
+  `a` int(11) DEFAULT NULL,
+  `b` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t14169459_2;
+Table	Create Table
+t14169459_2	CREATE TABLE `t14169459_2` (
+  `a` int(11) DEFAULT NULL,
+  `b` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+### directory of MYSQL_DATA_DIR/test
+t14169459_2.frm
+t14169459_2.ibd
+### directory of MYSQL_TMP_DIR/mysqld.1
+#sql<temporary>.ibd
+FLUSH TABLES t14169459_2 FOR EXPORT;
+SELECT * FROM t14169459_2;
+a	b
+1	one
+2	two
+UNLOCK TABLES;
+### directory of MYSQL_DATA_DIR/test
+t14169459_2.frm
+t14169459_2.ibd
+ALTER TABLE t14169459_2 DISCARD TABLESPACE;
+SELECT * FROM t14169459_2;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't14169459_2'
+### directory of MYSQL_DATA_DIR/test
+t14169459_2.frm
+t14169459_2.ibt
+### directory of MYSQL_TMP_DIR/mysqld.1
+#sql<temporary>.ibd
+DROP TABLE t14169459_1;
+DROP TABLE t14169459_2;
+### directory of MYSQL_DATA_DIR/test
+### directory of MYSQL_TMP_DIR/mysqld.1

=== added file 'mysql-test/suite/innodb/t/innodb_bug14169459.test'
--- a/mysql-test/suite/innodb/t/innodb_bug14169459.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug14169459.test	revid:kevin.lewis@stripped
@@ -0,0 +1,64 @@
+# This is the test for bug #14169459.
+
+--source include/have_innodb.inc
+
+SET default_storage_engine=InnoDB;
+
+--disable_query_log
+# These values can change during the test
+LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+
+# Set up some variables
+LET $MYSQL_DATA_DIR = `select @@datadir`;
+--enable_query_log
+
+SET GLOBAL innodb_file_per_table=ON;
+
+--echo #
+--echo # Create a temporary table and drop it.  Make sure the ibd file is gone.
+--echo # Make sure a discarded table can be dropped with all files deleted.
+--echo #
+CREATE TEMPORARY TABLE t14169459_1 (a INT, b TEXT) engine=InnoDB;
+CREATE TABLE t14169459_2 (a INT, b TEXT) engine=InnoDB;
+
+INSERT INTO t14169459_1 VALUES (1, 'one'),(2, 'two');
+INSERT INTO t14169459_2 VALUES (1, 'one'),(2, 'two');
+SELECT * FROM t14169459_1;
+SELECT * FROM t14169459_2;
+SHOW CREATE TABLE t14169459_1;
+SHOW CREATE TABLE t14169459_2;
+
+--echo ### directory of MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### directory of MYSQL_TMP_DIR/mysqld.1
+--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
+--list_files $MYSQL_TMP_DIR/mysqld.1 *.ibd
+
+FLUSH TABLES t14169459_2 FOR EXPORT;
+SELECT * FROM t14169459_2;
+UNLOCK TABLES;
+--echo ### directory of MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+ALTER TABLE t14169459_2 DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t14169459_2;
+--echo ### directory of MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### directory of MYSQL_TMP_DIR/mysqld.1
+--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
+--list_files $MYSQL_TMP_DIR/mysqld.1 *.ibd
+
+#--file_exists $MYSQL_TMP_DIR/mysqld.1/#sql15f8_2_1.ibd
+
+DROP TABLE t14169459_1;
+DROP TABLE t14169459_2;
+--echo ### directory of MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### directory of MYSQL_TMP_DIR/mysqld.1
+--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
+--list_files $MYSQL_TMP_DIR/mysqld.1 *.ibd
+
+-- disable_query_log
+eval set global innodb_file_per_table=$innodb_file_per_table_orig;
+-- enable_query_log
+

=== modified file 'storage/innobase/fil/fil0fil.cc'
--- a/storage/innobase/fil/fil0fil.cc	revid:dmitry.lenev@stripped
+++ b/storage/innobase/fil/fil0fil.cc	revid:kevin.lewis@stripped
@@ -716,7 +716,7 @@ fil_node_open_file(
 			OS_FILE_READ_ONLY, &success);
 		if (!success) {
 			/* The following call prints an error message */
-			os_file_get_last_error(TRUE);
+			os_file_get_last_error(true);
 
 			ut_print_timestamp(stderr);
 
@@ -2578,10 +2578,10 @@ fil_delete_tablespace(
 	} else if (rename) {
 		char*	newpath = fil_make_ibt_name(path);
 
+		/* Delete existing ibt in case it exists. */
+		os_file_delete_if_exists(newpath);
+
 		if (!os_file_rename(
-			innodb_file_data_key, path, newpath)
-		    && !os_file_delete_if_exists(newpath)
-		    && !os_file_rename(
 			innodb_file_data_key, path, newpath)) {
 
 			/* Note: This is because we have removed the
@@ -2757,7 +2757,7 @@ fil_make_ibd_name(
 /*==============*/
 	const char*	name,		/*!< in: table name or a dir path of a
 					TEMPORARY table */
-	bool		is_temp)	/*!< in: TRUE if it is a dir path */
+	bool		is_temp)	/*!< in: true if name is a full path */
 {
 	char*	filename;
 	ulint	namelen		= strlen(name);
@@ -2972,6 +2972,7 @@ fil_create_new_single_table_tablespace(
 	byte*		buf2;
 	byte*		page;
 	char*		path;
+	const char*	fsp_name;
 	ibool		success;
 
 	ut_a(space_id > 0);
@@ -2980,6 +2981,7 @@ fil_create_new_single_table_tablespace(
 	ut_a(fsp_flags_is_valid(flags));
 
 	path = fil_make_ibd_name(tablename, is_temp);
+	fsp_name = is_temp ? path : tablename;
 
 	file = os_file_create(
 		innodb_file_data_key, path,
@@ -2996,7 +2998,7 @@ fil_create_new_single_table_tablespace(
 
 		/* The following call will print an error message */
 
-		err = os_file_get_last_error(TRUE);
+		err = os_file_get_last_error(true);
 
 		if (err == OS_FILE_ALREADY_EXISTS) {
 			fputs("InnoDB: The file already exists though"
@@ -3108,7 +3110,7 @@ error_exit2:
 
 	os_file_close(file);
 
-	success = fil_space_create(tablename, space_id, flags, FIL_TABLESPACE);
+	success = fil_space_create(fsp_name, space_id, flags, FIL_TABLESPACE);
 
 	if (!success) {
 		goto error_exit2;
@@ -3201,7 +3203,7 @@ fil_open_single_table_tablespace(
 
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		ut_print_timestamp(stderr);
 
@@ -3365,7 +3367,7 @@ fil_load_single_table_tablespace(
 		OS_FILE_READ_ONLY, &success);
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		fprintf(stderr,
 			"InnoDB: Error: could not open single-table tablespace"
@@ -3412,7 +3414,7 @@ fil_load_single_table_tablespace(
 
 	if (size == (os_offset_t) -1) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		fprintf(stderr,
 			"InnoDB: Error: could not measure the size"
@@ -3864,8 +3866,10 @@ ibool
 fil_space_for_table_exists_in_mem(
 /*==============================*/
 	ulint		id,		/*!< in: space id */
-	const char*	name,		/*!< in: table name in the standard
-					'databasename/tablename' format */
+	const char*	name,		/*!< in: table name used in
+					fil_space_create().  Either the
+					standard 'dbname/tablename' format
+					or table->dir_path_of_temp_table */
 	ibool		mark_space,	/*!< in: in crash recovery, at database
 					startup we mark all spaces which have
 					an associated table in the InnoDB
@@ -5242,7 +5246,7 @@ fil_tablespace_iterate(
 
 		if (!success) {
 			/* The following call prints an error message */
-			os_file_get_last_error(TRUE);
+			os_file_get_last_error(true);
 
 			ib_logf(IB_LOG_LEVEL_ERROR,
 				"Trying to import a tablespace, but could not "
@@ -5351,7 +5355,8 @@ PageCallback::set_zip_size(const buf_fra
 }
 
 /********************************************************************//**
-Delete the tablespace file and any temporary files. */
+Delete the tablespace file and any related files like .cfg or .ibt.
+This should not be called for temporary tables. */
 UNIV_INTERN
 void
 fil_delete_file(
@@ -5366,17 +5371,15 @@ fil_delete_file(
 
 	os_file_delete_if_exists(ibd_name);
 
-	mem_free(ibd_name);
-
-	char*	cfg_name = fil_make_cfg_name(name);
+	char*	cfg_name = fil_make_cfg_name(ibd_name);
 
 	os_file_delete_if_exists(cfg_name);
 
-	mem_free(cfg_name);
-
-	char*	ibt_name = fil_make_ibt_name(name);
+	char*	ibt_name = fil_make_ibt_name(ibd_name);
 
 	os_file_delete_if_exists(ibt_name);
 
+	mem_free(ibd_name);
+	mem_free(cfg_name);
 	mem_free(ibt_name);
 }

=== modified file 'storage/innobase/include/fil0fil.h'
--- a/storage/innobase/include/fil0fil.h	revid:dmitry.lenev@stripped
+++ b/storage/innobase/include/fil0fil.h	revid:kevin.lewis@stripped
@@ -753,10 +753,11 @@ fil_make_ibd_name(
 /*==============*/
 	const char*	name,		/*!< in: table name or a dir path of a
 					TEMPORARY table */
-	bool		is_temp);	/*!< in: true if it is a dir path */
+	bool		is_temp);	/*!< in: true if name is a full path */
 
 /********************************************************************//**
-Delete the tablespace file and any temporary files. */
+Delete the tablespace file and any related files like .cfg or .ibt.
+This should not be called for temporary tables. */
 UNIV_INTERN
 void
 fil_delete_file(

=== modified file 'storage/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h	revid:dmitry.lenev@stripped
+++ b/storage/innobase/include/os0file.h	revid:kevin.lewis@stripped
@@ -525,7 +525,7 @@ os_file_create_func(
 Deletes a file. The file has to be closed before calling this.
 @return	TRUE if success */
 UNIV_INTERN
-ibool
+bool
 os_file_delete(
 /*===========*/
 	const char*	name);	/*!< in: file path as a null-terminated
@@ -535,7 +535,7 @@ os_file_delete(
 Deletes a file if it exists. The file has to be closed before calling this.
 @return	TRUE if success */
 UNIV_INTERN
-ibool
+bool
 os_file_delete_if_exists(
 /*=====================*/
 	const char*	name);	/*!< in: file path as a null-terminated
@@ -826,7 +826,7 @@ UNIV_INTERN
 ulint
 os_file_get_last_error(
 /*===================*/
-	ibool	report_all_errors);	/*!< in: TRUE if we want an error message
+	bool	report_all_errors);	/*!< in: TRUE if we want an error message
 					printed of all errors */
 /*******************************************************************//**
 NOTE! Use the corresponding macro os_file_read(), not directly this function!

=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc	revid:dmitry.lenev@stripped
+++ b/storage/innobase/os/os0file.cc	revid:kevin.lewis@stripped
@@ -377,9 +377,9 @@ static
 ulint
 os_file_get_last_error_low(
 /*=======================*/
-	ibool	report_all_errors,	/*!< in: TRUE if we want an error
+	bool	report_all_errors,	/*!< in: TRUE if we want an error
 					message printed of all errors */
-	ibool	on_error_silent)	/*!< in: TRUE then don't print any
+	bool	on_error_silent)	/*!< in: TRUE then don't print any
 					diagnostic to the log */
 {
 #ifdef __WIN__
@@ -550,10 +550,10 @@ UNIV_INTERN
 ulint
 os_file_get_last_error(
 /*===================*/
-	ibool	report_all_errors)	/*!< in: TRUE if we want an error
+	bool	report_all_errors)	/*!< in: TRUE if we want an error
 					message printed of all errors */
 {
-	return(os_file_get_last_error_low(report_all_errors, FALSE));
+	return(os_file_get_last_error_low(report_all_errors, false));
 }
 
 /****************************************************************//**
@@ -575,7 +575,7 @@ os_file_handle_error_cond_exit(
 {
 	ulint	err;
 
-	err = os_file_get_last_error_low(FALSE, on_error_silent);
+	err = os_file_get_last_error_low(false, on_error_silent);
 
 	switch (err) {
 	case OS_FILE_DISK_FULL:
@@ -1662,14 +1662,14 @@ try_again:
 Deletes a file if it exists. The file has to be closed before calling this.
 @return	TRUE if success */
 UNIV_INTERN
-ibool
+bool
 os_file_delete_if_exists(
 /*=====================*/
 	const char*	name)	/*!< in: file path as a null-terminated
 				string */
 {
 #ifdef __WIN__
-	BOOL	ret;
+	bool	ret;
 	ulint	count	= 0;
 loop:
 	/* In Windows, deleting an .ibd file may fail if ibbackup is copying
@@ -1678,13 +1678,15 @@ loop:
 	ret = DeleteFile((LPCTSTR) name);
 
 	if (ret) {
-		return(TRUE);
+		return(true);
 	}
 
-	if (GetLastError() == ERROR_FILE_NOT_FOUND) {
+	DWORD lasterr = GetLastError();
+	if (lasterr == ERROR_FILE_NOT_FOUND
+	    || lasterr == ERROR_PATH_NOT_FOUND) {
 		/* the file does not exist, this not an error */
 
-		return(TRUE);
+		return(true);
 	}
 
 	count++;
@@ -1695,14 +1697,14 @@ loop:
 			"InnoDB: Are you running ibbackup"
 			" to back up the file?\n", name);
 
-		os_file_get_last_error(TRUE); /* print error information */
+		os_file_get_last_error(true); /* print error information */
 	}
 
 	os_thread_sleep(1000000);	/* sleep for a second */
 
 	if (count > 2000) {
 
-		return(FALSE);
+		return(false);
 	}
 
 	goto loop;
@@ -1714,10 +1716,10 @@ loop:
 	if (ret != 0 && errno != ENOENT) {
 		os_file_handle_error_no_exit(name, "delete", FALSE);
 
-		return(FALSE);
+		return(false);
 	}
 
-	return(TRUE);
+	return(true);
 #endif
 }
 
@@ -1725,7 +1727,7 @@ loop:
 Deletes a file. The file has to be closed before calling this.
 @return	TRUE if success */
 UNIV_INTERN
-ibool
+bool
 os_file_delete(
 /*===========*/
 	const char*	name)	/*!< in: file path as a null-terminated
@@ -1741,14 +1743,14 @@ loop:
 	ret = DeleteFile((LPCTSTR) name);
 
 	if (ret) {
-		return(TRUE);
+		return(true);
 	}
 
 	if (GetLastError() == ERROR_FILE_NOT_FOUND) {
 		/* If the file does not exist, we classify this as a 'mild'
 		error and return */
 
-		return(FALSE);
+		return(false);
 	}
 
 	count++;
@@ -1759,14 +1761,14 @@ loop:
 			"InnoDB: Are you running ibbackup"
 			" to back up the file?\n", name);
 
-		os_file_get_last_error(TRUE); /* print error information */
+		os_file_get_last_error(true); /* print error information */
 	}
 
 	os_thread_sleep(1000000);	/* sleep for a second */
 
 	if (count > 2000) {
 
-		return(FALSE);
+		return(false);
 	}
 
 	goto loop;
@@ -1778,10 +1780,10 @@ loop:
 	if (ret != 0) {
 		os_file_handle_error_no_exit(name, "delete", FALSE);
 
-		return(FALSE);
+		return(false);
 	}
 
-	return(TRUE);
+	return(true);
 #endif
 }
 

=== modified file 'storage/innobase/row/row0mysql.cc'
--- a/storage/innobase/row/row0mysql.cc	revid:dmitry.lenev@stripped
+++ b/storage/innobase/row/row0mysql.cc	revid:kevin.lewis@stripped
@@ -3532,7 +3532,8 @@ row_drop_table_for_mysql(
 	dict_table_t*	table;
 	ibool		print_msg;
 	ulint		space_id;
-	const char*	table_name;
+	const char*	tablename_minus_db;
+	char*		tablename =  NULL;
 	bool		ibd_file_missing;
 	ulint		namelen;
 	bool		locked_dictionary	= false;
@@ -3555,19 +3556,19 @@ row_drop_table_for_mysql(
 	Certain table names starting with 'innodb_' have their special
 	meaning regardless of the database name.  Thus, we need to
 	ignore the database name prefix in the comparisons. */
-	table_name = strchr(name, '/');
+	tablename_minus_db = strchr(name, '/');
 
-	if (table_name) {
-		table_name++;
+	if (tablename_minus_db) {
+		tablename_minus_db++;
 	} else {
 		/* Ancillary FTS tables don't have '/' characters. */
-		table_name = name;
+		tablename_minus_db = name;
 	}
 
-	namelen = strlen(table_name) + 1;
+	namelen = strlen(tablename_minus_db) + 1;
 
 	if (namelen == sizeof S_innodb_monitor
-	    && !memcmp(table_name, S_innodb_monitor,
+	    && !memcmp(tablename_minus_db, S_innodb_monitor,
 		       sizeof S_innodb_monitor)) {
 
 		/* Table name equals "innodb_monitor":
@@ -3576,17 +3577,17 @@ row_drop_table_for_mysql(
 		srv_print_innodb_monitor = FALSE;
 		srv_print_innodb_lock_monitor = FALSE;
 	} else if (namelen == sizeof S_innodb_lock_monitor
-		   && !memcmp(table_name, S_innodb_lock_monitor,
+		   && !memcmp(tablename_minus_db, S_innodb_lock_monitor,
 			      sizeof S_innodb_lock_monitor)) {
 		srv_print_innodb_monitor = FALSE;
 		srv_print_innodb_lock_monitor = FALSE;
 	} else if (namelen == sizeof S_innodb_tablespace_monitor
-		   && !memcmp(table_name, S_innodb_tablespace_monitor,
+		   && !memcmp(tablename_minus_db, S_innodb_tablespace_monitor,
 			      sizeof S_innodb_tablespace_monitor)) {
 
 		srv_print_innodb_tablespace_monitor = FALSE;
 	} else if (namelen == sizeof S_innodb_table_monitor
-		   && !memcmp(table_name, S_innodb_table_monitor,
+		   && !memcmp(tablename_minus_db, S_innodb_table_monitor,
 			      sizeof S_innodb_table_monitor)) {
 
 		srv_print_innodb_table_monitor = FALSE;
@@ -3722,16 +3723,16 @@ check_next_foreign:
 
 	if (table->n_foreign_key_checks_running > 0) {
 
-		const char*	table_name = table->name;
+		const char*	save_tablename = table->name;
 		ibool		added;
 
-		added = row_add_table_to_background_drop_list(table_name);
+		added = row_add_table_to_background_drop_list(save_tablename);
 
 		if (added) {
 			ut_print_timestamp(stderr);
 			fputs("  InnoDB: You are trying to drop table ",
 			      stderr);
-			ut_print_name(stderr, trx, TRUE, table_name);
+			ut_print_name(stderr, trx, TRUE, save_tablename);
 			fputs("\n"
 			      "InnoDB: though there is a"
 			      " foreign key check running on it.\n"
@@ -3821,6 +3822,7 @@ check_next_foreign:
 	unsigned*	page_nos;
 	heap = mem_heap_create(
 		200 + UT_LIST_GET_LEN(table->indexes) * sizeof *page_nos);
+	tablename = mem_heap_strdup(heap, name);
 
 	page_no = page_nos = static_cast<unsigned*>(
 		mem_heap_alloc(
@@ -3926,18 +3928,18 @@ check_next_foreign:
 			   , FALSE, trx);
 
 	switch (err) {
-		ibool		is_temp;
+		ibool	is_temp;
 
 	case DB_SUCCESS:
 		/* Clone the name, in case it has been allocated
 		from table->heap, which will be freed by
 		dict_table_remove_from_cache(table) below. */
-		name = mem_heap_strdup(heap, name);
 		space_id = table->space;
 		ibd_file_missing = table->ibd_file_missing;
 
 		is_temp = table->flags2 & DICT_TF2_TEMPORARY;
 		ut_a(table->dir_path_of_temp_table == NULL || is_temp);
+		ut_a(!is_temp || table->dir_path_of_temp_table);
 
 		if (dict_table_has_fts_index(table)
 		    || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
@@ -3949,7 +3951,7 @@ check_next_foreign:
 				fprintf(stderr," InnoDB: Error: (%s) not "
 					"able to remove ancillary FTS tables "
 					"for table ", ut_strerr(err));
-				ut_print_name(stderr, trx, TRUE, name);
+				ut_print_name(stderr, trx, TRUE, tablename);
 				fputs("\n", stderr);
 
 				goto funct_exit;
@@ -3966,11 +3968,12 @@ check_next_foreign:
 
 		dict_table_remove_from_cache(table);
 
-		if (dict_load_table(name, TRUE, DICT_ERR_IGNORE_NONE) != NULL) {
+		if (dict_load_table(tablename, TRUE,
+				    DICT_ERR_IGNORE_NONE) != NULL) {
 			ut_print_timestamp(stderr);
 			fputs("  InnoDB: Error: not able to remove table ",
 			      stderr);
-			ut_print_name(stderr, trx, TRUE, name);
+			ut_print_name(stderr, trx, TRUE, tablename);
 			fputs(" from the dictionary cache!\n", stderr);
 			err = DB_ERROR;
 		}
@@ -3980,31 +3983,33 @@ check_next_foreign:
 
 		/* Don't spam the log if we can't find the tablespace of
 		a temp table or if the tablesace has been discarded. */
-
 		print_msg = !(is_temp || ibd_file_missing);
 
 		if (err == DB_SUCCESS && space_id > 0) {
-			if (!fil_space_for_table_exists_in_mem(
-					space_id, name, FALSE, print_msg)) {
+			if (!is_temp
+			    && !fil_space_for_table_exists_in_mem(
+					space_id, tablename, FALSE, print_msg)) {
+				/* This might happen if we are dropping a
+				discarded tablespace */
 				err = DB_SUCCESS;
 
 				if (print_msg) {
-					char table_name[MAX_FULL_NAME_LEN + 1];
+					char msg_tablename[MAX_FULL_NAME_LEN + 1];
 
 					innobase_format_name(
-						table_name, sizeof(table_name),
-						name, FALSE);
+						msg_tablename, sizeof(tablename),
+						tablename, FALSE);
 
 					ib_logf(IB_LOG_LEVEL_INFO,
 						"Removed the table %s from "
 						"InnoDB's data dictionary",
-						table_name);
+						msg_tablename);
 				}
 
 				/* Force a delete of any discarded
 				or temporary files. */
 
-				fil_delete_file(name);
+				fil_delete_file(tablename);
 
 			} else if (fil_delete_tablespace(space_id, FALSE)
 				   != DB_SUCCESS) {
@@ -4012,7 +4017,7 @@ check_next_foreign:
 					"InnoDB: We removed now the InnoDB"
 					" internal data dictionary entry\n"
 					"InnoDB: of table ");
-				ut_print_name(stderr, trx, TRUE, name);
+				ut_print_name(stderr, trx, TRUE, tablename);
 				fprintf(stderr, ".\n");
 
 				ut_print_timestamp(stderr);
@@ -4020,7 +4025,7 @@ check_next_foreign:
 					"  InnoDB: Error: not able to"
 					" delete tablespace %lu of table ",
 					(ulong) space_id);
-				ut_print_name(stderr, trx, TRUE, name);
+				ut_print_name(stderr, trx, TRUE, tablename);
 				fputs("!\n", stderr);
 				err = DB_ERROR;
 			}
@@ -4050,7 +4055,7 @@ check_next_foreign:
 
 		fprintf(stderr, "InnoDB: unknown error code %lu"
 			" while dropping table:", (ulong) err);
-		ut_print_name(stderr, trx, TRUE, name);
+		ut_print_name(stderr, trx, TRUE, tablename);
 		fprintf(stderr, ".\n");
 
 		trx->error_state = DB_SUCCESS;

=== modified file 'storage/innobase/srv/srv0start.cc'
--- a/storage/innobase/srv/srv0start.cc	revid:dmitry.lenev@stripped
+++ b/storage/innobase/srv/srv0start.cc	revid:kevin.lewis@stripped
@@ -568,12 +568,12 @@ open_or_create_log_file(
 				  OS_FILE_CREATE, OS_FILE_NORMAL,
 				  OS_LOG_FILE, &ret);
 	if (ret == FALSE) {
-		if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
+		if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS
 #ifdef UNIV_AIX
 		    /* AIX 5.1 after security patch ML7 may have errno set
 		    to 0 here, which causes our function to return 100;
 		    work around that AIX problem */
-		    && os_file_get_last_error(FALSE) != 100
+		    && os_file_get_last_error(false) != 100
 #endif
 		    ) {
 			fprintf(stderr,
@@ -760,13 +760,13 @@ open_or_create_data_files(
 						  OS_FILE_NORMAL,
 						  OS_DATA_FILE, &ret);
 
-			if (ret == FALSE && os_file_get_last_error(FALSE)
+			if (ret == FALSE && os_file_get_last_error(false)
 			    != OS_FILE_ALREADY_EXISTS
 #ifdef UNIV_AIX
 			    /* AIX 5.1 after security patch ML7 may have
 			    errno set to 0 here, which causes our function
 			    to return 100; work around that AIX problem */
-			    && os_file_get_last_error(FALSE) != 100
+			    && os_file_get_last_error(false) != 100
 #endif
 			    ) {
 				fprintf(stderr,
@@ -835,7 +835,7 @@ open_or_create_data_files(
 			if (!ret) {
 				fprintf(stderr,
 					"InnoDB: Error in opening %s\n", name);
-				os_file_get_last_error(TRUE);
+				os_file_get_last_error(true);
 
 				return(DB_ERROR);
 			}
@@ -1011,12 +1011,12 @@ srv_undo_tablespace_create(
 		OS_FILE_NORMAL, OS_DATA_FILE, &ret);
 
 	if (ret == FALSE
-	    && os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
+	    && os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS
 #ifdef UNIV_AIX
 	    /* AIX 5.1 after security patch ML7 may have
 	    errno set to 0 here, which causes our function
 	    to return 100; work around that AIX problem */
-	    && os_file_get_last_error(FALSE) != 100
+	    && os_file_get_last_error(false) != 100
 #endif
 		) {
 

=== modified file 'storage/innobase/trx/trx0sys.cc'
--- a/storage/innobase/trx/trx0sys.cc	revid:dmitry.lenev@stripped
+++ b/storage/innobase/trx/trx0sys.cc	revid:kevin.lewis@stripped
@@ -999,7 +999,7 @@ trx_sys_read_file_format_id(
 	);
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		ut_print_timestamp(stderr);
 
@@ -1018,7 +1018,7 @@ trx_sys_read_file_format_id(
 
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		ut_print_timestamp(stderr);
 
@@ -1079,7 +1079,7 @@ trx_sys_read_pertable_file_format_id(
 	);
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		ut_print_timestamp(stderr);
 
@@ -1098,7 +1098,7 @@ trx_sys_read_pertable_file_format_id(
 
 	if (!success) {
 		/* The following call prints an error message */
-		os_file_get_last_error(TRUE);
+		os_file_get_last_error(true);
 
 		ut_print_timestamp(stderr);
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (kevin.lewis:4018 to 4019) Bug#14169459kevin.lewis18 Jun