Commit 5a93636f authored by marko's avatar marko

branches/zip: Fix some link errors.

ha_innobase::update_thd(void): New function, to call the inline function
ha_innobase::update_thd(THD*).

check_trx_exists(): Make static.  handler0alter.cc does not need to call
this function.
parent 3877f691
...@@ -917,7 +917,7 @@ innobase_convert_string( ...@@ -917,7 +917,7 @@ innobase_convert_string(
Gets the InnoDB transaction handle for a MySQL handler object, creates Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still an InnoDB transaction struct if the corresponding MySQL thread struct still
lacks one. */ lacks one. */
extern "C" static
trx_t* trx_t*
check_trx_exists( check_trx_exists(
/*=============*/ /*=============*/
...@@ -985,10 +985,9 @@ Updates the user_thd field in a handle and also allocates a new InnoDB ...@@ -985,10 +985,9 @@ Updates the user_thd field in a handle and also allocates a new InnoDB
transaction handle if needed, and updates the transaction fields in the transaction handle if needed, and updates the transaction fields in the
prebuilt struct. */ prebuilt struct. */
inline inline
int void
ha_innobase::update_thd( ha_innobase::update_thd(
/*====================*/ /*====================*/
/* out: 0 or error code */
THD* thd) /* in: thd to use the handle */ THD* thd) /* in: thd to use the handle */
{ {
trx_t* trx; trx_t* trx;
...@@ -1001,8 +1000,20 @@ ha_innobase::update_thd( ...@@ -1001,8 +1000,20 @@ ha_innobase::update_thd(
} }
user_thd = thd; user_thd = thd;
}
return(0); /*************************************************************************
Updates the user_thd field in a handle and also allocates a new InnoDB
transaction handle if needed, and updates the transaction fields in the
prebuilt struct. */
void
ha_innobase::update_thd()
/*=====================*/
{
THD* thd = ha_thd();
ut_ad(thd == current_thd);
update_thd(thd);
} }
/************************************************************************* /*************************************************************************
......
...@@ -69,7 +69,8 @@ class ha_innobase: public handler ...@@ -69,7 +69,8 @@ class ha_innobase: public handler
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len, uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const uchar* record); const uchar* record);
int update_thd(THD* thd); inline void update_thd(THD* thd);
void update_thd();
int change_active_index(uint keynr); int change_active_index(uint keynr);
int general_fetch(uchar* buf, uint direction, uint match_mode); int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret); int innobase_read_and_init_auto_inc(longlong* ret);
...@@ -255,17 +256,6 @@ int thd_binlog_format(const MYSQL_THD thd); ...@@ -255,17 +256,6 @@ int thd_binlog_format(const MYSQL_THD thd);
} }
typedef struct trx_struct trx_t; typedef struct trx_struct trx_t;
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
lacks one. */
extern "C"
trx_t*
check_trx_exists(
/*=============*/
/* out: InnoDB transaction handle */
MYSQL_THD thd) /* in: user thread handle */
__attribute__((nonnull));
/************************************************************************ /************************************************************************
Converts an InnoDB error code to a MySQL error code and also tells to MySQL Converts an InnoDB error code to a MySQL error code and also tells to MySQL
about a possible transaction rollback inside InnoDB caused by a lock wait about a possible transaction rollback inside InnoDB caused by a lock wait
......
...@@ -643,13 +643,13 @@ ha_innobase::add_index( ...@@ -643,13 +643,13 @@ ha_innobase::add_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND); DBUG_RETURN(HA_ERR_WRONG_COMMAND);
} }
update_thd(ha_thd()); update_thd();
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads. */ possible adaptive hash latch to avoid deadlocks of threads. */
trx_search_latch_release_if_reserved(check_trx_exists(user_thd)); trx_search_latch_release_if_reserved(prebuilt->trx);
trx = trx_allocate_for_mysql(); trx = trx_allocate_for_mysql();
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
...@@ -922,7 +922,6 @@ ha_innobase::prepare_drop_index( ...@@ -922,7 +922,6 @@ ha_innobase::prepare_drop_index(
uint num_of_keys) /* in: Number of keys to be dropped */ uint num_of_keys) /* in: Number of keys to be dropped */
{ {
trx_t* trx; trx_t* trx;
THD* thd;
int err = 0; int err = 0;
uint n_key; uint n_key;
...@@ -934,10 +933,10 @@ ha_innobase::prepare_drop_index( ...@@ -934,10 +933,10 @@ ha_innobase::prepare_drop_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND); DBUG_RETURN(HA_ERR_WRONG_COMMAND);
} }
thd = ha_thd(); update_thd();
trx = check_trx_exists(thd); trx_search_latch_release_if_reserved(prebuilt->trx);
trx_search_latch_release_if_reserved(trx); trx = prebuilt->trx;
/* Test and mark all the indexes to be dropped */ /* Test and mark all the indexes to be dropped */
...@@ -989,7 +988,7 @@ ha_innobase::prepare_drop_index( ...@@ -989,7 +988,7 @@ ha_innobase::prepare_drop_index(
is later deleted. */ is later deleted. */
if (trx->check_foreigns if (trx->check_foreigns
&& thd_sql_command(thd) != SQLCOM_CREATE_INDEX) { && thd_sql_command(user_thd) != SQLCOM_CREATE_INDEX) {
for (n_key = 0; n_key < num_of_keys; n_key++) { for (n_key = 0; n_key < num_of_keys; n_key++) {
KEY* key; KEY* key;
dict_index_t* index; dict_index_t* index;
...@@ -1073,7 +1072,6 @@ ha_innobase::final_drop_index( ...@@ -1073,7 +1072,6 @@ ha_innobase::final_drop_index(
{ {
dict_index_t* index; /* Index to be dropped */ dict_index_t* index; /* Index to be dropped */
trx_t* trx; /* Transaction */ trx_t* trx; /* Transaction */
THD* thd;
DBUG_ENTER("ha_innobase::final_drop_index"); DBUG_ENTER("ha_innobase::final_drop_index");
ut_ad(table); ut_ad(table);
...@@ -1082,10 +1080,10 @@ ha_innobase::final_drop_index( ...@@ -1082,10 +1080,10 @@ ha_innobase::final_drop_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND); DBUG_RETURN(HA_ERR_WRONG_COMMAND);
} }
thd = ha_thd(); update_thd();
trx = check_trx_exists(thd); trx_search_latch_release_if_reserved(prebuilt->trx);
trx_search_latch_release_if_reserved(trx); trx = prebuilt->trx;
/* Drop indexes marked to be dropped */ /* Drop indexes marked to be dropped */
......
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