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

 3216 Satya B	2009-11-30
      Applying InnoDB snapshot 5.1-ss6242, part 5. Fixes BUG#45961
      
      1. BUG#45961 - DDL on partitioned innodb tables leaves data dictionary 
                     in an inconsistent state
      
      2. Fix formatting
      
      Detailed revision comments:
      
      r6205 | jyang | 2009-11-20 07:55:48 +0200 (Fri, 20 Nov 2009) | 11 lines
      branches/5.1: Add a special case to handle the Duplicated Key error
      and return DB_ERROR instead. This is to avoid a possible SIGSEGV
      by mysql error handling re-entering the storage layer for dup key
      info without proper table handle.
      This is to prevent a server crash when error situation in bug
      #45961 "DDL on partitioned innodb tables leaves data dictionary
      in an inconsistent state" happens.
      
      rb://157 approved by Sunny Bains.
      
      
      r6206 | jyang | 2009-11-20 09:38:43 +0200 (Fri, 20 Nov 2009) | 3 lines
      branches/5.1: Non-functional change, fix formatting.

    modified:
      storage/innobase/handler/ha_innodb.cc
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-11-30 08:26:45 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-11-30 09:03:57 +0000
@@ -662,6 +662,12 @@ convert_error_code_to_mysql(
 
 	} else if (error == (int) DB_DUPLICATE_KEY) {
 
+		/* Be cautious with returning this error, since
+		mysql could re-enter the storage layer to get
+		duplicated key info, the operation requires a
+		valid table handle and/or transaction information,
+		which might not always be available in the error
+		handling stage. */
 		return(HA_ERR_FOUND_DUPP_KEY);
 
 	} else if (error == (int) DB_FOREIGN_DUPLICATE_KEY) {
@@ -6038,6 +6044,24 @@ ha_innobase::rename_table(
 	innobase_commit_low(trx);
 	trx_free_for_mysql(trx);
 
+	/* Add a special case to handle the Duplicated Key error
+	and return DB_ERROR instead.
+	This is to avoid a possible SIGSEGV error from mysql error
+	handling code. Currently, mysql handles the Duplicated Key
+	error by re-entering the storage layer and getting dup key
+	info by calling get_dup_key(). This operation requires a valid
+	table handle ('row_prebuilt_t' structure) which could no
+	longer be available in the error handling stage. The suggested
+	solution is to report a 'table exists' error message (since
+	the dup key error here is due to an existing table whose name
+	is the one we are trying to rename to) and return the generic
+	error code. */
+	if (error == (int) DB_DUPLICATE_KEY) {
+		my_error(ER_TABLE_EXISTS_ERROR, MYF(0), to);
+
+		error = DB_ERROR;
+	}
+
 	error = convert_error_code_to_mysql(error, NULL);
 
 	DBUG_RETURN(error);


Attachment: [text/bzr-bundle] bzr/satya.bn@sun.com-20091130090357-otu81dm00kgbe2hp.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:3216) Bug#45961Satya B30 Nov