Commit 3b99f0d1 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 22b01120
......@@ -917,7 +917,7 @@ innobase_convert_string(
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"
static
trx_t*
check_trx_exists(
/*=============*/
......@@ -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
prebuilt struct. */
inline
int
void
ha_innobase::update_thd(
/*====================*/
/* out: 0 or error code */
THD* thd) /* in: thd to use the handle */
{
trx_t* trx;
......@@ -1001,8 +1000,20 @@ ha_innobase::update_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
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const uchar* record);
int update_thd(THD* thd);
inline void update_thd(THD* thd);
void update_thd();
int change_active_index(uint keynr);
int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret);
......@@ -255,17 +256,6 @@ int thd_binlog_format(const MYSQL_THD thd);
}
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
about a possible transaction rollback inside InnoDB caused by a lock wait
......
......@@ -643,13 +643,13 @@ ha_innobase::add_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
update_thd(ha_thd());
update_thd();
heap = mem_heap_create(1024);
/* In case MySQL calls this in the middle of a SELECT query, release
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_start_if_not_started(trx);
......@@ -922,7 +922,6 @@ ha_innobase::prepare_drop_index(
uint num_of_keys) /* in: Number of keys to be dropped */
{
trx_t* trx;
THD* thd;
int err = 0;
uint n_key;
......@@ -934,10 +933,10 @@ ha_innobase::prepare_drop_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
thd = ha_thd();
update_thd();
trx = check_trx_exists(thd);
trx_search_latch_release_if_reserved(trx);
trx_search_latch_release_if_reserved(prebuilt->trx);
trx = prebuilt->trx;
/* Test and mark all the indexes to be dropped */
......@@ -989,7 +988,7 @@ ha_innobase::prepare_drop_index(
is later deleted. */
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++) {
KEY* key;
dict_index_t* index;
......@@ -1073,7 +1072,6 @@ ha_innobase::final_drop_index(
{
dict_index_t* index; /* Index to be dropped */
trx_t* trx; /* Transaction */
THD* thd;
DBUG_ENTER("ha_innobase::final_drop_index");
ut_ad(table);
......@@ -1082,10 +1080,10 @@ ha_innobase::final_drop_index(
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
thd = ha_thd();
update_thd();
trx = check_trx_exists(thd);
trx_search_latch_release_if_reserved(trx);
trx_search_latch_release_if_reserved(prebuilt->trx);
trx = prebuilt->trx;
/* 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