List:Commits« Previous MessageNext Message »
From:Satya B Date:November 30 2009 11:56am
Subject:bzr commit into mysql-5.1-bugteam branch (satya.bn:3223) Bug#47167
View as plain text  
#At file:///home/satya/WORK/mysql/mysql-5.1-bugteam/ based on revid:satya.bn@stripped

 3223 Satya B	2009-11-30
      Applying InnoDB Plugin 1.0.6 snapshot, part 3. Fixes BUG#47167
      
      applied revisions: r6157
      
      Detailed revision comments:
      
      r6157 | jyang | 2009-11-11 14:27:09 +0200 (Wed, 11 Nov 2009) | 10 lines
      branches/zip: Fix an issue that a local variable defined
      in innodb_file_format_check_validate() is being referenced
      across function in innodb_file_format_check_update().
      In addition, fix "set global innodb_file_format_check =
      DEFAULT" call.
      Bug #47167: "set global innodb_file_format_check" cannot
      set value by User-Defined Variable."
      rb://169 approved by Sunny Bains and Marko.

    added:
      mysql-test/suite/innodb/r/innodb_bug47167.result
      mysql-test/suite/innodb/t/innodb_bug47167.test
    modified:
      mysql-test/suite/innodb/r/innodb_file_format.result
      storage/innodb_plugin/handler/ha_innodb.cc
=== added file 'mysql-test/suite/innodb/r/innodb_bug47167.result'
--- a/mysql-test/suite/innodb/r/innodb_bug47167.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug47167.result	2009-11-30 11:56:21 +0000
@@ -0,0 +1,24 @@
+set @old_innodb_file_format_check=@@innodb_file_format_check;
+select @old_innodb_file_format_check;
+@old_innodb_file_format_check
+Antelope
+set global innodb_file_format_check = Barracuda;
+select @@innodb_file_format_check;
+@@innodb_file_format_check
+Barracuda
+set global innodb_file_format_check = DEFAULT;
+select @@innodb_file_format_check;
+@@innodb_file_format_check
+Barracuda
+set global innodb_file_format_check = @old_innodb_file_format_check;
+select @@innodb_file_format_check;
+@@innodb_file_format_check
+Antelope
+set global innodb_file_format_check = cheetah;
+ERROR HY000: Incorrect arguments to SET
+set global innodb_file_format_check = Bear;
+ERROR HY000: Incorrect arguments to SET
+set global innodb_file_format_check = on;
+ERROR HY000: Incorrect arguments to SET
+set global innodb_file_format_check = off;
+ERROR HY000: Incorrect arguments to SET

=== modified file 'mysql-test/suite/innodb/r/innodb_file_format.result'
--- a/mysql-test/suite/innodb/r/innodb_file_format.result	2009-09-02 16:58:17 +0000
+++ b/mysql-test/suite/innodb/r/innodb_file_format.result	2009-11-30 11:56:21 +0000
@@ -31,8 +31,6 @@ select @@innodb_file_format_check;
 @@innodb_file_format_check
 Barracuda
 set global innodb_file_format_check=default;
-Warnings:
-Warning	1210	Ignoring SET innodb_file_format=on
 select @@innodb_file_format_check;
 @@innodb_file_format_check
 Barracuda

=== added file 'mysql-test/suite/innodb/t/innodb_bug47167.test'
--- a/mysql-test/suite/innodb/t/innodb_bug47167.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug47167.test	2009-11-30 11:56:21 +0000
@@ -0,0 +1,46 @@
+# This is the unit test for bug *47167.
+# It tests setting the global variable
+# "innodb_file_format_check" with a
+# user-Defined Variable.
+
+--source include/have_innodb.inc
+-- source suite/innodb/include/have_innodb_plugin.inc
+
+# Save the value (Antelope) in 'innodb_file_format_check' to
+# 'old_innodb_file_format_check'
+set @old_innodb_file_format_check=@@innodb_file_format_check;
+
+# @old_innodb_file_format_check shall have the value of 'Antelope'
+select @old_innodb_file_format_check;
+
+# Reset the value in 'innodb_file_format_check' to 'Barracuda'
+set global innodb_file_format_check = Barracuda;
+
+select @@innodb_file_format_check;
+
+# Set 'innodb_file_format_check' to its default value, which
+# is the latest file format supported in the current release.
+set global innodb_file_format_check = DEFAULT;
+
+select @@innodb_file_format_check;
+
+# Put the saved value back to 'innodb_file_format_check'
+set global innodb_file_format_check = @old_innodb_file_format_check;
+
+# Check whether 'innodb_file_format_check' get its original value.
+select @@innodb_file_format_check;
+
+# Following are negative tests, all should fail.
+--disable_warnings
+--error ER_WRONG_ARGUMENTS
+set global innodb_file_format_check = cheetah;
+
+--error ER_WRONG_ARGUMENTS
+set global innodb_file_format_check = Bear;
+
+--error ER_WRONG_ARGUMENTS
+set global innodb_file_format_check = on;
+
+--error ER_WRONG_ARGUMENTS
+set global innodb_file_format_check = off;
+--enable_warnings

=== modified file 'storage/innodb_plugin/handler/ha_innodb.cc'
--- a/storage/innodb_plugin/handler/ha_innodb.cc	2009-11-30 11:42:51 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.cc	2009-11-30 11:56:21 +0000
@@ -269,10 +269,10 @@ innobase_file_format_check_on_off(
 /************************************************************//**
 Validate the file format check config parameters, as a side effect it
 sets the srv_check_file_format_at_startup variable.
-@return	true if valid config value */
+@return	the format_id if valid config value, otherwise, return -1 */
 static
-bool
-innobase_file_format_check_validate(
+int
+innobase_file_format_validate_and_set(
 /*================================*/
 	const char*	format_check);		/*!< in: parameter value */
 /****************************************************************//**
@@ -2146,8 +2146,8 @@ mem_free_and_error:
 		/* Did the user specify a format name that we support ?
 		As a side effect it will update the variable
 		srv_check_file_format_at_startup */
-		if (!innobase_file_format_check_validate(
-			innobase_file_format_check)) {
+		if (innobase_file_format_validate_and_set(
+				innobase_file_format_check) < 0) {
 
 			sql_print_error("InnoDB: invalid "
 					"innodb_file_format_check value: "
@@ -9503,25 +9503,24 @@ innobase_file_format_check_on_off(
 /************************************************************//**
 Validate the file format check config parameters, as a side effect it
 sets the srv_check_file_format_at_startup variable.
-@return	true if valid config value */
+@return the format_id if valid config value, otherwise, return -1 */
 static
-bool
-innobase_file_format_check_validate(
+int
+innobase_file_format_validate_and_set(
 /*================================*/
 	const char*	format_check)	/*!< in: parameter value */
 {
 	uint		format_id;
-	bool		ret = true;
 
 	format_id = innobase_file_format_name_lookup(format_check);
 
 	if (format_id < DICT_TF_FORMAT_MAX + 1) {
 		srv_check_file_format_at_startup = format_id;
+
+		return((int) format_id);
 	} else {
-		ret = false;
+		return(-1);
 	}
-
-	return(ret);
 }
 
 /*************************************************************//**
@@ -9556,7 +9555,11 @@ innodb_file_format_name_validate(
 
 		if (format_id <= DICT_TF_FORMAT_MAX) {
 
-			*static_cast<const char**>(save) = file_format_input;
+			/* Save a pointer to the name in the
+			'file_format_name_map' constant array. */
+			*static_cast<const char**>(save) =
+			    trx_sys_file_format_id_to_name(format_id);
+
 			return(0);
 		}
 	}
@@ -9619,6 +9622,7 @@ innodb_file_format_check_validate(
 	const char*	file_format_input;
 	char		buff[STRING_BUFFER_USUAL_SIZE];
 	int		len = sizeof(buff);
+	int		format_id;
 
 	ut_a(save != NULL);
 	ut_a(value != NULL);
@@ -9631,24 +9635,35 @@ innodb_file_format_check_validate(
 		message if they did so. */
 
 		if (innobase_file_format_check_on_off(file_format_input)) {
-			sql_print_warning(
+			push_warning_printf(thd,
+				MYSQL_ERROR::WARN_LEVEL_WARN,
+				ER_WRONG_ARGUMENTS,
 				"InnoDB: invalid innodb_file_format_check "
 				"value; on/off can only be set at startup or "
 				"in the configuration file");
-		} else if (innobase_file_format_check_validate(
-				file_format_input)) {
+		} else {
+			format_id = innobase_file_format_validate_and_set(
+							file_format_input);
 
-			*static_cast<const char**>(save) = file_format_input;
+			if (format_id >= 0) {
+				/* Save a pointer to the name in the
+				'file_format_name_map' constant array. */
+				*static_cast<const char**>(save) =
+				    trx_sys_file_format_id_to_name(
+							(uint)format_id);
 
-			return(0);
+				return(0);
 
-		} else {
-			sql_print_warning(
-				"InnoDB: invalid innodb_file_format_check "
-				"value; can be any format up to %s "
-				"or its equivalent numeric id",
-				trx_sys_file_format_id_to_name(
-					DICT_TF_FORMAT_MAX));
+			} else {
+				push_warning_printf(thd,
+				  MYSQL_ERROR::WARN_LEVEL_WARN,
+				  ER_WRONG_ARGUMENTS,
+				  "InnoDB: invalid innodb_file_format_check "
+				  "value; can be any format up to %s "
+				  "or its equivalent numeric id",
+				  trx_sys_file_format_id_to_name(
+						DICT_TF_FORMAT_MAX));
+			}
 		}
 	}
 
@@ -9918,12 +9933,15 @@ static MYSQL_SYSVAR_STR(file_format, inn
   innodb_file_format_name_validate,
   innodb_file_format_name_update, "Antelope");
 
+/* If a new file format is introduced, the file format
+name needs to be updated accordingly. Please refer to
+file_format_name_map[] defined in trx0sys.c for the next
+file format name. */
 static MYSQL_SYSVAR_STR(file_format_check, innobase_file_format_check,
   PLUGIN_VAR_OPCMDARG,
   "The highest file format in the tablespace.",
   innodb_file_format_check_validate,
-  innodb_file_format_check_update,
-  "on");
+  innodb_file_format_check_update, "Barracuda");
 
 static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
   PLUGIN_VAR_OPCMDARG,


Attachment: [text/bzr-bundle] bzr/satya.bn@sun.com-20091130115621-ulbhn5xq15uunanu.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:3223) Bug#47167Satya B30 Nov