Commit ae55711e authored by Vasil Dimov's avatar Vasil Dimov

Merge mysql-5.1-innodb from bk-internal into my local tree

parents fbfbe2a6 ff8cf2e9
...@@ -2140,7 +2140,7 @@ dict_foreign_add_to_cache( ...@@ -2140,7 +2140,7 @@ dict_foreign_add_to_cache(
mem_heap_free(foreign->heap); mem_heap_free(foreign->heap);
} }
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_FOREIGN_NO_INDEX);
} }
for_in_cache->referenced_table = ref_table; for_in_cache->referenced_table = ref_table;
...@@ -2184,7 +2184,7 @@ dict_foreign_add_to_cache( ...@@ -2184,7 +2184,7 @@ dict_foreign_add_to_cache(
mem_heap_free(foreign->heap); mem_heap_free(foreign->heap);
} }
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_REFERENCING_NO_INDEX);
} }
for_in_cache->foreign_table = for_table; for_in_cache->foreign_table = for_table;
......
...@@ -707,7 +707,9 @@ convert_error_code_to_mysql( ...@@ -707,7 +707,9 @@ convert_error_code_to_mysql(
return(HA_ERR_ROW_IS_REFERENCED); return(HA_ERR_ROW_IS_REFERENCED);
} else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) { } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT
|| error == (int) DB_FOREIGN_NO_INDEX
|| error == (int) DB_REFERENCING_NO_INDEX) {
return(HA_ERR_CANNOT_ADD_FOREIGN); return(HA_ERR_CANNOT_ADD_FOREIGN);
...@@ -6099,6 +6101,8 @@ ha_innobase::rename_table( ...@@ -6099,6 +6101,8 @@ ha_innobase::rename_table(
innobase_commit_low(trx); innobase_commit_low(trx);
trx_free_for_mysql(trx); trx_free_for_mysql(trx);
switch (error) {
case DB_DUPLICATE_KEY:
/* Add a special case to handle the Duplicated Key error /* Add a special case to handle the Duplicated Key error
and return DB_ERROR instead. and return DB_ERROR instead.
This is to avoid a possible SIGSEGV error from mysql error This is to avoid a possible SIGSEGV error from mysql error
...@@ -6111,10 +6115,28 @@ ha_innobase::rename_table( ...@@ -6111,10 +6115,28 @@ ha_innobase::rename_table(
the dup key error here is due to an existing table whose name 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 is the one we are trying to rename to) and return the generic
error code. */ error code. */
if (error == (int) DB_DUPLICATE_KEY) {
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), to); my_error(ER_TABLE_EXISTS_ERROR, MYF(0), to);
error = DB_ERROR; error = DB_ERROR;
break;
case DB_FOREIGN_NO_INDEX:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
HA_ERR_CANNOT_ADD_FOREIGN,
"Alter or rename of table '%s' failed"
" because the new table is a child table"
" in a FK relationship and it does not"
" have an index that contains foreign"
" keys as its prefix columns.", norm_to);
break;
case DB_REFERENCING_NO_INDEX:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
HA_ERR_CANNOT_ADD_FOREIGN,
"Alter or rename of table '%s' failed"
" because the new table is a parent table"
" in a FK relationship and it does not"
" have an index that contains foreign"
" keys as its prefix columns.", norm_to);
break;
} }
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
...@@ -7814,16 +7836,17 @@ ha_innobase::store_lock( ...@@ -7814,16 +7836,17 @@ ha_innobase::store_lock(
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT && (sql_command == SQLCOM_INSERT_SELECT
|| sql_command == SQLCOM_UPDATE || sql_command == SQLCOM_UPDATE
|| sql_command == SQLCOM_CREATE_TABLE)) { || sql_command == SQLCOM_CREATE_TABLE
|| sql_command == SQLCOM_SET_OPTION)) {
/* If we either have innobase_locks_unsafe_for_binlog /* If we either have innobase_locks_unsafe_for_binlog
option set or this session is using READ COMMITTED option set or this session is using READ COMMITTED
isolation level and isolation level of the transaction isolation level and isolation level of the transaction
is not set to serializable and MySQL is doing is not set to serializable and MySQL is doing
INSERT INTO...SELECT or UPDATE ... = (SELECT ...) or INSERT INTO...SELECT or UPDATE ... = (SELECT ...) or
CREATE ... SELECT... without FOR UPDATE or CREATE ... SELECT... or SET ... = (SELECT ...)
IN SHARE MODE in select, then we use consistent without FOR UPDATE or IN SHARE MODE in select,
read for select. */ then we use consistent read for select. */
prebuilt->select_lock_type = LOCK_NONE; prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE;
......
...@@ -73,6 +73,12 @@ Created 5/24/1996 Heikki Tuuri ...@@ -73,6 +73,12 @@ Created 5/24/1996 Heikki Tuuri
a later version of the engine. */ a later version of the engine. */
#define DB_INTERRUPTED 49 /* the query has been interrupted with #define DB_INTERRUPTED 49 /* the query has been interrupted with
"KILL QUERY N;" */ "KILL QUERY N;" */
#define DB_FOREIGN_NO_INDEX 50 /* the child (foreign) table does not
have an index that contains the
foreign keys as its prefix columns */
#define DB_REFERENCING_NO_INDEX 51 /* the parent (referencing) table does
not have an index that contains the
foreign keys as its prefix columns */
/* The following are partial failure codes */ /* The following are partial failure codes */
#define DB_FAIL 1000 #define DB_FAIL 1000
......
2010-08-03 The InnoDB Team
* include/ut0mem.h, ut/ut0mem.c:
Fix Bug #55627 segv in ut_free pars_lexer_close innobase_shutdown
innodb-use-sys-malloc=0
2010-08-01 The InnoDB Team
* handler/ha_innodb.cc
Fix Bug #55382 Assignment with SELECT expressions takes unexpected
S locks in READ COMMITTED
2010-07-27 The InnoDB Team 2010-07-27 The InnoDB Team
* include/mem0pool.h, mem/mem0mem.c, mem/mem0pool.c, srv/srv0start.c: * include/mem0pool.h, mem/mem0mem.c, mem/mem0pool.c, srv/srv0start.c:
......
...@@ -1734,6 +1734,7 @@ btr_search_update_hash_on_insert( ...@@ -1734,6 +1734,7 @@ btr_search_update_hash_on_insert(
} }
} }
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/********************************************************************//** /********************************************************************//**
Validates the search system. Validates the search system.
@return TRUE if ok */ @return TRUE if ok */
...@@ -1897,3 +1898,4 @@ btr_search_validate(void) ...@@ -1897,3 +1898,4 @@ btr_search_validate(void)
return(ok); return(ok);
} }
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
...@@ -354,6 +354,7 @@ ha_remove_all_nodes_to_page( ...@@ -354,6 +354,7 @@ ha_remove_all_nodes_to_page(
#endif #endif
} }
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/*************************************************************//** /*************************************************************//**
Validates a given range of the cells in hash table. Validates a given range of the cells in hash table.
@return TRUE if ok */ @return TRUE if ok */
...@@ -400,6 +401,7 @@ ha_validate( ...@@ -400,6 +401,7 @@ ha_validate(
return(ok); return(ok);
} }
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/*************************************************************//** /*************************************************************//**
Prints info of a hash table. */ Prints info of a hash table. */
......
...@@ -9235,7 +9235,8 @@ ha_innobase::store_lock( ...@@ -9235,7 +9235,8 @@ ha_innobase::store_lock(
&& (sql_command == SQLCOM_INSERT_SELECT && (sql_command == SQLCOM_INSERT_SELECT
|| sql_command == SQLCOM_REPLACE_SELECT || sql_command == SQLCOM_REPLACE_SELECT
|| sql_command == SQLCOM_UPDATE || sql_command == SQLCOM_UPDATE
|| sql_command == SQLCOM_CREATE_TABLE)) { || sql_command == SQLCOM_CREATE_TABLE
|| sql_command == SQLCOM_SET_OPTION)) {
/* If we either have innobase_locks_unsafe_for_binlog /* If we either have innobase_locks_unsafe_for_binlog
option set or this session is using READ COMMITTED option set or this session is using READ COMMITTED
...@@ -9243,9 +9244,9 @@ ha_innobase::store_lock( ...@@ -9243,9 +9244,9 @@ ha_innobase::store_lock(
is not set to serializable and MySQL is doing is not set to serializable and MySQL is doing
INSERT INTO...SELECT or REPLACE INTO...SELECT INSERT INTO...SELECT or REPLACE INTO...SELECT
or UPDATE ... = (SELECT ...) or CREATE ... or UPDATE ... = (SELECT ...) or CREATE ...
SELECT... without FOR UPDATE or IN SHARE SELECT... or SET ... = (SELECT ...) without
MODE in select, then we use consistent read FOR UPDATE or IN SHARE MODE in select,
for select. */ then we use consistent read for select. */
prebuilt->select_lock_type = LOCK_NONE; prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE;
......
...@@ -180,6 +180,7 @@ btr_search_update_hash_on_delete( ...@@ -180,6 +180,7 @@ btr_search_update_hash_on_delete(
btr_cur_t* cursor);/*!< in: cursor which was positioned on the btr_cur_t* cursor);/*!< in: cursor which was positioned on the
record to delete using btr_cur_search_..., record to delete using btr_cur_search_...,
the record is not yet deleted */ the record is not yet deleted */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/********************************************************************//** /********************************************************************//**
Validates the search system. Validates the search system.
@return TRUE if ok */ @return TRUE if ok */
...@@ -187,6 +188,9 @@ UNIV_INTERN ...@@ -187,6 +188,9 @@ UNIV_INTERN
ibool ibool
btr_search_validate(void); btr_search_validate(void);
/*======================*/ /*======================*/
#else
# define btr_search_validate() TRUE
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/** Flag: has the search system been enabled? /** Flag: has the search system been enabled?
Protected by btr_search_latch and btr_search_enabled_mutex. */ Protected by btr_search_latch and btr_search_enabled_mutex. */
......
...@@ -186,6 +186,7 @@ ha_remove_all_nodes_to_page( ...@@ -186,6 +186,7 @@ ha_remove_all_nodes_to_page(
hash_table_t* table, /*!< in: hash table */ hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: fold value */ ulint fold, /*!< in: fold value */
const page_t* page); /*!< in: buffer page */ const page_t* page); /*!< in: buffer page */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/*************************************************************//** /*************************************************************//**
Validates a given range of the cells in hash table. Validates a given range of the cells in hash table.
@return TRUE if ok */ @return TRUE if ok */
...@@ -196,6 +197,7 @@ ha_validate( ...@@ -196,6 +197,7 @@ ha_validate(
hash_table_t* table, /*!< in: hash table */ hash_table_t* table, /*!< in: hash table */
ulint start_index, /*!< in: start index */ ulint start_index, /*!< in: start index */
ulint end_index); /*!< in: end index */ ulint end_index); /*!< in: end index */
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/*************************************************************//** /*************************************************************//**
Prints info of a hash table. */ Prints info of a hash table. */
UNIV_INTERN UNIV_INTERN
......
...@@ -113,7 +113,8 @@ ut_test_malloc( ...@@ -113,7 +113,8 @@ ut_test_malloc(
ulint n); /*!< in: try to allocate this many bytes */ ulint n); /*!< in: try to allocate this many bytes */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/**********************************************************************//** /**********************************************************************//**
Frees a memory block allocated with ut_malloc. */ Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
a nop. */
UNIV_INTERN UNIV_INTERN
void void
ut_free( ut_free(
......
...@@ -290,7 +290,8 @@ ut_test_malloc( ...@@ -290,7 +290,8 @@ ut_test_malloc(
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/**********************************************************************//** /**********************************************************************//**
Frees a memory block allocated with ut_malloc. */ Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
a nop. */
UNIV_INTERN UNIV_INTERN
void void
ut_free( ut_free(
...@@ -300,7 +301,9 @@ ut_free( ...@@ -300,7 +301,9 @@ ut_free(
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ut_mem_block_t* block; ut_mem_block_t* block;
if (UNIV_LIKELY(srv_use_sys_malloc)) { if (ptr == NULL) {
return;
} else if (UNIV_LIKELY(srv_use_sys_malloc)) {
free(ptr); free(ptr);
return; return;
} }
......
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