Commit b0493252 authored by Rich Prohaska's avatar Rich Prohaska

#228 use thd_get/set_ha_data for tokudb_trx data

parent 5624a03c
...@@ -120,14 +120,6 @@ extern "C" { ...@@ -120,14 +120,6 @@ extern "C" {
#include "hatoku_defines.h" #include "hatoku_defines.h"
#include "hatoku_cmp.h" #include "hatoku_cmp.h"
static inline void *thd_data_get(THD *thd, int slot) {
return thd->ha_data[slot].ha_ptr;
}
static inline void thd_data_set(THD *thd, int slot, void *data) {
thd->ha_data[slot].ha_ptr = data;
}
static inline uint get_key_parts(const KEY *key); static inline uint get_key_parts(const KEY *key);
#undef PACKAGE #undef PACKAGE
...@@ -1016,8 +1008,7 @@ static uchar* pack_toku_field_blob( ...@@ -1016,8 +1008,7 @@ static uchar* pack_toku_field_blob(
static int create_tokudb_trx_data_instance(tokudb_trx_data** out_trx) { static int create_tokudb_trx_data_instance(tokudb_trx_data** out_trx) {
int error; int error;
tokudb_trx_data* trx = NULL; tokudb_trx_data* trx = (tokudb_trx_data *) tokudb_my_malloc(sizeof(*trx), MYF(MY_ZEROFILL));
trx = (tokudb_trx_data *) tokudb_my_malloc(sizeof(*trx), MYF(MY_ZEROFILL));
if (!trx) { if (!trx) {
error = ENOMEM; error = ENOMEM;
goto cleanup; goto cleanup;
...@@ -1614,8 +1605,7 @@ int ha_tokudb::initialize_share( ...@@ -1614,8 +1605,7 @@ int ha_tokudb::initialize_share(
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
bool do_commit = false; bool do_commit = false;
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data *trx = NULL; tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(ha_thd(), tokudb_hton);
trx = (tokudb_trx_data *) thd_data_get(ha_thd(), tokudb_hton->slot);
if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) { if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) {
txn = trx->sub_sp_level; txn = trx->sub_sp_level;
} }
...@@ -3260,7 +3250,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) { ...@@ -3260,7 +3250,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
TOKUDB_HANDLER_DBUG_ENTER("%llu txn %p", (unsigned long long) rows, transaction); TOKUDB_HANDLER_DBUG_ENTER("%llu txn %p", (unsigned long long) rows, transaction);
#endif #endif
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
delay_updating_ai_metadata = true; delay_updating_ai_metadata = true;
ai_metadata_update_required = false; ai_metadata_update_required = false;
abort_loader = false; abort_loader = false;
...@@ -3328,7 +3318,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ...@@ -3328,7 +3318,7 @@ int ha_tokudb::end_bulk_insert(bool abort) {
TOKUDB_HANDLER_DBUG_ENTER(""); TOKUDB_HANDLER_DBUG_ENTER("");
int error = 0; int error = 0;
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
bool using_loader = (loader != NULL); bool using_loader = (loader != NULL);
if (ai_metadata_update_required) { if (ai_metadata_update_required) {
tokudb_pthread_mutex_lock(&share->mutex); tokudb_pthread_mutex_lock(&share->mutex);
...@@ -4060,7 +4050,7 @@ int ha_tokudb::write_row(uchar * record) { ...@@ -4060,7 +4050,7 @@ int ha_tokudb::write_row(uchar * record) {
} }
} }
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
if (!error) { if (!error) {
added_rows++; added_rows++;
trx->stmt_progress.inserted++; trx->stmt_progress.inserted++;
...@@ -4117,7 +4107,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -4117,7 +4107,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
THD* thd = ha_thd(); THD* thd = ha_thd();
DB_TXN* sub_trans = NULL; DB_TXN* sub_trans = NULL;
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
uint curr_num_DBs; uint curr_num_DBs;
LINT_INIT(error); LINT_INIT(error);
...@@ -4291,7 +4281,7 @@ int ha_tokudb::delete_row(const uchar * record) { ...@@ -4291,7 +4281,7 @@ int ha_tokudb::delete_row(const uchar * record) {
bool has_null; bool has_null;
THD* thd = ha_thd(); THD* thd = ha_thd();
uint curr_num_DBs; uint curr_num_DBs;
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
ha_statistic_increment(&SSV::ha_delete_count); ha_statistic_increment(&SSV::ha_delete_count);
...@@ -4855,7 +4845,7 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_ ...@@ -4855,7 +4845,7 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_
int error = 0; int error = 0;
uint32_t flags = 0; uint32_t flags = 0;
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
struct smart_dbt_info info; struct smart_dbt_info info;
struct index_read_info ir_info; struct index_read_info ir_info;
...@@ -5333,7 +5323,7 @@ int ha_tokudb::get_next(uchar* buf, int direction, DBT* key_to_compare, bool do_ ...@@ -5333,7 +5323,7 @@ int ha_tokudb::get_next(uchar* buf, int direction, DBT* key_to_compare, bool do_
int error = 0; int error = 0;
uint32_t flags = SET_PRELOCK_FLAG(0); uint32_t flags = SET_PRELOCK_FLAG(0);
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
bool need_val; bool need_val;
HANDLE_INVALID_CURSOR(); HANDLE_INVALID_CURSOR();
...@@ -5486,7 +5476,7 @@ int ha_tokudb::index_first(uchar * buf) { ...@@ -5486,7 +5476,7 @@ int ha_tokudb::index_first(uchar * buf) {
struct smart_dbt_info info; struct smart_dbt_info info;
uint32_t flags = SET_PRELOCK_FLAG(0); uint32_t flags = SET_PRELOCK_FLAG(0);
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
HANDLE_INVALID_CURSOR(); HANDLE_INVALID_CURSOR();
ha_statistic_increment(&SSV::ha_read_first_count); ha_statistic_increment(&SSV::ha_read_first_count);
...@@ -5529,7 +5519,7 @@ int ha_tokudb::index_last(uchar * buf) { ...@@ -5529,7 +5519,7 @@ int ha_tokudb::index_last(uchar * buf) {
struct smart_dbt_info info; struct smart_dbt_info info;
uint32_t flags = SET_PRELOCK_FLAG(0); uint32_t flags = SET_PRELOCK_FLAG(0);
THD* thd = ha_thd(); THD* thd = ha_thd();
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
HANDLE_INVALID_CURSOR(); HANDLE_INVALID_CURSOR();
ha_statistic_increment(&SSV::ha_read_last_count); ha_statistic_increment(&SSV::ha_read_last_count);
...@@ -5620,7 +5610,7 @@ int ha_tokudb::rnd_next(uchar * buf) { ...@@ -5620,7 +5610,7 @@ int ha_tokudb::rnd_next(uchar * buf) {
void ha_tokudb::track_progress(THD* thd) { void ha_tokudb::track_progress(THD* thd) {
tokudb_trx_data* trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
if (trx) { if (trx) {
ulonglong num_written = trx->stmt_progress.inserted + trx->stmt_progress.updated + trx->stmt_progress.deleted; ulonglong num_written = trx->stmt_progress.inserted + trx->stmt_progress.updated + trx->stmt_progress.deleted;
bool update_status = bool update_status =
...@@ -6205,12 +6195,11 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) { ...@@ -6205,12 +6195,11 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
} }
int error = 0; int error = 0;
tokudb_trx_data *trx = NULL; tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) { if (!trx) {
error = create_tokudb_trx_data_instance(&trx); error = create_tokudb_trx_data_instance(&trx);
if (error) { goto cleanup; } if (error) { goto cleanup; }
thd_data_set(thd, tokudb_hton->slot, trx); thd_set_ha_data(thd, tokudb_hton, trx);
} }
if (trx->all == NULL) { if (trx->all == NULL) {
trx->sp_level = NULL; trx->sp_level = NULL;
...@@ -6284,7 +6273,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) { ...@@ -6284,7 +6273,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
TOKUDB_HANDLER_TRACE("q %s", thd->query()); TOKUDB_HANDLER_TRACE("q %s", thd->query());
int error = 0; int error = 0;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
DBUG_ASSERT(trx); DBUG_ASSERT(trx);
/* /*
...@@ -6898,7 +6887,7 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in ...@@ -6898,7 +6887,7 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
newname = (char *)tokudb_my_malloc(get_max_dict_name_path_length(name),MYF(MY_WME)); newname = (char *)tokudb_my_malloc(get_max_dict_name_path_length(name),MYF(MY_WME));
if (newname == NULL){ error = ENOMEM; goto cleanup;} if (newname == NULL){ error = ENOMEM; goto cleanup;}
trx = (tokudb_trx_data *) thd_data_get(ha_thd(), tokudb_hton->slot); trx = (tokudb_trx_data *) thd_get_ha_data(ha_thd(), tokudb_hton);
if (trx && trx->sub_sp_level && thd_sql_command(thd) == SQLCOM_CREATE_TABLE) { if (trx && trx->sub_sp_level && thd_sql_command(thd) == SQLCOM_CREATE_TABLE) {
txn = trx->sub_sp_level; txn = trx->sub_sp_level;
} }
...@@ -7088,7 +7077,7 @@ int ha_tokudb::delete_or_rename_table (const char* from_name, const char* to_nam ...@@ -7088,7 +7077,7 @@ int ha_tokudb::delete_or_rename_table (const char* from_name, const char* to_nam
DB_TXN *parent_txn = NULL; DB_TXN *parent_txn = NULL;
tokudb_trx_data *trx = NULL; tokudb_trx_data *trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
if (thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) { if (thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) {
parent_txn = trx->sub_sp_level; parent_txn = trx->sub_sp_level;
} }
...@@ -8234,12 +8223,12 @@ void ha_tokudb::cleanup_txn(DB_TXN *txn) { ...@@ -8234,12 +8223,12 @@ void ha_tokudb::cleanup_txn(DB_TXN *txn) {
} }
void ha_tokudb::add_to_trx_handler_list() { void ha_tokudb::add_to_trx_handler_list() {
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(ha_thd(), tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(ha_thd(), tokudb_hton);
trx->handlers = list_add(trx->handlers, &trx_handler_list); trx->handlers = list_add(trx->handlers, &trx_handler_list);
} }
void ha_tokudb::remove_from_trx_handler_list() { void ha_tokudb::remove_from_trx_handler_list() {
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(ha_thd(), tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(ha_thd(), tokudb_hton);
trx->handlers = list_delete(trx->handlers, &trx_handler_list); trx->handlers = list_delete(trx->handlers, &trx_handler_list);
} }
......
...@@ -752,7 +752,7 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i ...@@ -752,7 +752,7 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
if (!commit) { if (!commit) {
// abort the alter transaction NOW so that any alters are rolled back. this allows the following restores to work. // abort the alter transaction NOW so that any alters are rolled back. this allows the following restores to work.
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
assert(ctx->alter_txn == trx->stmt); assert(ctx->alter_txn == trx->stmt);
assert(trx->tokudb_lock_count > 0); assert(trx->tokudb_lock_count > 0);
// for partitioned tables, we use a single transaction to do all of the partition changes. the tokudb_lock_count // for partitioned tables, we use a single transaction to do all of the partition changes. the tokudb_lock_count
......
...@@ -814,7 +814,7 @@ int ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) { ...@@ -814,7 +814,7 @@ int ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
if (TOKU_PARTITION_WRITE_FRM_DATA || table->part_info == NULL) { if (TOKU_PARTITION_WRITE_FRM_DATA || table->part_info == NULL) {
// write frmdata to status // write frmdata to status
THD *thd = ha_thd(); THD *thd = ha_thd();
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
assert(trx); assert(trx);
DB_TXN *txn = trx->stmt; // use alter table transaction DB_TXN *txn = trx->stmt; // use alter table transaction
assert(txn); assert(txn);
......
...@@ -624,8 +624,7 @@ int tokudb_end(handlerton * hton, ha_panic_function type) { ...@@ -624,8 +624,7 @@ int tokudb_end(handlerton * hton, ha_panic_function type) {
static int tokudb_close_connection(handlerton * hton, THD * thd) { static int tokudb_close_connection(handlerton * hton, THD * thd) {
int error = 0; int error = 0;
tokudb_trx_data* trx = NULL; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (trx && trx->checkpoint_lock_taken) { if (trx && trx->checkpoint_lock_taken) {
error = db_env->checkpointing_resume(db_env); error = db_env->checkpointing_resume(db_env);
} }
...@@ -723,7 +722,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) { ...@@ -723,7 +722,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("");
DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt")); DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt"));
uint32_t syncflag = THDVAR(thd, commit_sync) ? 0 : DB_TXN_NOSYNC; uint32_t syncflag = THDVAR(thd, commit_sync) ? 0 : DB_TXN_NOSYNC;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN **txn = all ? &trx->all : &trx->stmt; DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn; DB_TXN *this_txn = *txn;
if (this_txn) { if (this_txn) {
...@@ -752,7 +751,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) { ...@@ -752,7 +751,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
static int tokudb_rollback(handlerton * hton, THD * thd, bool all) { static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("");
DBUG_PRINT("trans", ("aborting transaction %s", all ? "all" : "stmt")); DBUG_PRINT("trans", ("aborting transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN **txn = all ? &trx->all : &trx->stmt; DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn; DB_TXN *this_txn = *txn;
if (this_txn) { if (this_txn) {
...@@ -782,7 +781,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) { ...@@ -782,7 +781,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("");
int r = 0; int r = 0;
DBUG_PRINT("trans", ("preparing transaction %s", all ? "all" : "stmt")); DBUG_PRINT("trans", ("preparing transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN* txn = all ? trx->all : trx->stmt; DB_TXN* txn = all ? trx->all : trx->stmt;
if (txn) { if (txn) {
if (tokudb_debug & TOKUDB_DEBUG_TXN) { if (tokudb_debug & TOKUDB_DEBUG_TXN) {
...@@ -861,7 +860,7 @@ static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint) { ...@@ -861,7 +860,7 @@ static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("");
int error; int error;
SP_INFO save_info = (SP_INFO)savepoint; SP_INFO save_info = (SP_INFO)savepoint;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
if (thd->in_sub_stmt) { if (thd->in_sub_stmt) {
assert(trx->stmt); assert(trx->stmt);
error = txn_begin(db_env, trx->sub_sp_level, &(save_info->txn), DB_INHERIT_ISOLATION, thd); error = txn_begin(db_env, trx->sub_sp_level, &(save_info->txn), DB_INHERIT_ISOLATION, thd);
...@@ -892,7 +891,7 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save ...@@ -892,7 +891,7 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save
DB_TXN* parent = NULL; DB_TXN* parent = NULL;
DB_TXN* txn_to_rollback = save_info->txn; DB_TXN* txn_to_rollback = save_info->txn;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
parent = txn_to_rollback->parent; parent = txn_to_rollback->parent;
if (!(error = txn_to_rollback->abort(txn_to_rollback))) { if (!(error = txn_to_rollback->abort(txn_to_rollback))) {
if (save_info->in_sub_stmt) { if (save_info->in_sub_stmt) {
...@@ -914,7 +913,7 @@ static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoin ...@@ -914,7 +913,7 @@ static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoin
DB_TXN* parent = NULL; DB_TXN* parent = NULL;
DB_TXN* txn_to_commit = save_info->txn; DB_TXN* txn_to_commit = save_info->txn;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
parent = txn_to_commit->parent; parent = txn_to_commit->parent;
if (!(error = txn_to_commit->commit(txn_to_commit, 0))) { if (!(error = txn_to_commit->commit(txn_to_commit, 0))) {
if (save_info->in_sub_stmt) { if (save_info->in_sub_stmt) {
...@@ -974,7 +973,7 @@ static int tokudb_discover3(handlerton *hton, THD* thd, const char *db, const ch ...@@ -974,7 +973,7 @@ static int tokudb_discover3(handlerton *hton, THD* thd, const char *db, const ch
bool do_commit; bool do_commit;
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099 #if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) { if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) {
do_commit = false; do_commit = false;
txn = trx->sub_sp_level; txn = trx->sub_sp_level;
...@@ -1129,15 +1128,14 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1129,15 +1128,14 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
static void tokudb_checkpoint_lock(THD * thd) { static void tokudb_checkpoint_lock(THD * thd) {
int error; int error;
const char *old_proc_info; const char *old_proc_info;
tokudb_trx_data* trx = NULL; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) { if (!trx) {
error = create_tokudb_trx_data_instance(&trx); error = create_tokudb_trx_data_instance(&trx);
// //
// can only fail due to memory allocation, so ok to assert // can only fail due to memory allocation, so ok to assert
// //
assert(!error); assert(!error);
thd_data_set(thd, tokudb_hton->slot, trx); thd_set_ha_data(thd, tokudb_hton, trx);
} }
if (trx->checkpoint_lock_taken) { if (trx->checkpoint_lock_taken) {
...@@ -1161,8 +1159,7 @@ cleanup: ...@@ -1161,8 +1159,7 @@ cleanup:
static void tokudb_checkpoint_unlock(THD * thd) { static void tokudb_checkpoint_unlock(THD * thd) {
int error; int error;
const char *old_proc_info; const char *old_proc_info;
tokudb_trx_data* trx = NULL; tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) { if (!trx) {
error = 0; error = 0;
goto cleanup; goto cleanup;
......
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