Commit 8ae5ee8d authored by vasil's avatar vasil

branches/zip: Merge r6198:6206 from branches/5.1:

(r6203 was skipped as it is already in branches/zip)

  ------------------------------------------------------------------------
  r6200 | vasil | 2009-11-19 12:14:23 +0200 (Thu, 19 Nov 2009) | 4 lines
  Changed paths:
     M /branches/5.1/btr/btr0btr.c
  
  branches/5.1:
  
  White space fixup - indent under the opening (
  
  ------------------------------------------------------------------------
  r6203 | jyang | 2009-11-19 15:12:22 +0200 (Thu, 19 Nov 2009) | 8 lines
  Changed paths:
     M /branches/5.1/btr/btr0btr.c
  
  branches/5.1: Use btr_free_root() instead of fseg_free() for
  the fix of bug #48469, because fseg_free() is not defined
  in the zip branch. And we could save one mini-trasaction started
  by fseg_free().
  
  Approved by Marko.
  
  
  ------------------------------------------------------------------------
  r6205 | jyang | 2009-11-20 07:55:48 +0200 (Fri, 20 Nov 2009) | 11 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  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) | 5 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1: Fix a minor code formating issue for 
  the parenthesis iplacement of the if condition in
  rename_table().
  
  
  ------------------------------------------------------------------------
parent de12b326
...@@ -793,6 +793,12 @@ convert_error_code_to_mysql( ...@@ -793,6 +793,12 @@ convert_error_code_to_mysql(
return(-1); /* unspecified error */ return(-1); /* unspecified error */
case DB_DUPLICATE_KEY: case 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); return(HA_ERR_FOUND_DUPP_KEY);
case DB_FOREIGN_DUPLICATE_KEY: case DB_FOREIGN_DUPLICATE_KEY:
...@@ -6815,6 +6821,24 @@ ha_innobase::rename_table( ...@@ -6815,6 +6821,24 @@ ha_innobase::rename_table(
innobase_commit_low(trx); innobase_commit_low(trx);
trx_free_for_mysql(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, 0, NULL); error = convert_error_code_to_mysql(error, 0, NULL);
DBUG_RETURN(error); DBUG_RETURN(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment