Commit 2f948975 authored by Rich Prohaska's avatar Rich Prohaska

#250 restore proc info to valid pointers in commit, abort, analyze, and optimize

parent af53db60
......@@ -469,7 +469,6 @@ typedef struct index_read_info {
DBT* orig_key;
} *INDEX_READ_INFO;
static int ai_poll_fun(void *extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (context->thd->killed) {
......@@ -3322,10 +3321,10 @@ int ha_tokudb::end_bulk_insert(bool abort) {
if (loader) {
if (!abort_loader && !thd->killed) {
DBUG_EXECUTE_IF("tokudb_end_bulk_insert_sleep", {
const char *old_proc_info = tokudb_thd_get_proc_info(thd);
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
thd_proc_info(thd, "DBUG sleep");
my_sleep(20000000);
thd_proc_info(thd, old_proc_info);
thd_proc_info(thd, orig_proc_info);
});
error = loader->close(loader);
loader = NULL;
......@@ -3398,7 +3397,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in
uint64_t cnt = 0;
char status_msg[MAX_ALIAS_NAME + 200]; //buffer of 200 should be a good upper bound.
THD* thd = ha_thd();
const char *old_proc_info = tokudb_thd_get_proc_info(thd);
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
memset(&key1, 0, sizeof(key1));
memset(&key2, 0, sizeof(key2));
memset(&val, 0, sizeof(val));
......@@ -3475,7 +3474,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in
error = 0;
cleanup:
thd_proc_info(thd, old_proc_info);
thd_proc_info(thd, orig_proc_info);
if (tmp_cursor1) {
tmp_cursor1->c_close(tmp_cursor1);
tmp_cursor1 = NULL;
......@@ -7429,7 +7428,7 @@ int ha_tokudb::tokudb_add_index(
DBC* tmp_cursor = NULL;
int cursor_ret_val = 0;
DBT curr_pk_key, curr_pk_val;
THD* thd = ha_thd();
THD* thd = ha_thd();
DB_LOADER* loader = NULL;
DB_INDEXER* indexer = NULL;
bool loader_save_space = get_load_save_space(thd);
......@@ -7467,7 +7466,7 @@ int ha_tokudb::tokudb_add_index(
//
// status message to be shown in "show process list"
//
const char *old_proc_info = tokudb_thd_get_proc_info(thd);
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
char status_msg[MAX_ALIAS_NAME + 200]; //buffer of 200 should be a good upper bound.
ulonglong num_processed = 0; //variable that stores number of elements inserted thus far
thd_proc_info(thd, "Adding indexes");
......@@ -7785,7 +7784,7 @@ int ha_tokudb::tokudb_add_index(
another transaction has accessed the table. \
To add indexes, make sure no transactions touch the table.", share->table_name);
}
thd_proc_info(thd, old_proc_info);
thd_proc_info(thd, orig_proc_info);
TOKUDB_HANDLER_DBUG_RETURN(error ? error : loader_error);
}
......
......@@ -128,6 +128,7 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
TOKUDB_HANDLER_DBUG_ENTER("%s", share->table_name);
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
uint64_t rec_per_key[table_share->key_parts];
int result = HA_ADMIN_OK;
......@@ -174,6 +175,7 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
if (error)
result = HA_ADMIN_FAILED;
}
thd_proc_info(thd, orig_proc_info);
TOKUDB_HANDLER_DBUG_RETURN(result);
}
......@@ -254,12 +256,14 @@ int ha_tokudb::do_optimize(THD *thd) {
int ha_tokudb::optimize(THD *thd, HA_CHECK_OPT *check_opt) {
TOKUDB_HANDLER_DBUG_ENTER("%s", share->table_name);
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
int error;
#if TOKU_OPTIMIZE_WITH_RECREATE
error = HA_ADMIN_TRY_ALTER;
#else
error = do_optimize(thd);
#endif
thd_proc_info(thd, orig_proc_info);
TOKUDB_HANDLER_DBUG_RETURN(error);
}
......@@ -290,10 +294,7 @@ static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
TOKUDB_HANDLER_DBUG_ENTER("%s", share->table_name);
const char *old_proc_info = tokudb_thd_get_proc_info(thd);
thd_proc_info(thd, "tokudb::check");
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
int result = HA_ADMIN_OK;
int r;
......@@ -345,6 +346,6 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
}
}
}
thd_proc_info(thd, old_proc_info);
thd_proc_info(thd, orig_proc_info);
TOKUDB_HANDLER_DBUG_RETURN(result);
}
......@@ -685,25 +685,27 @@ static void txn_progress_func(TOKU_TXN_PROGRESS progress, void* extra) {
}
static void commit_txn_with_progress(DB_TXN* txn, uint32_t flags, THD* thd) {
int r;
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
struct txn_progress_info info;
info.thd = thd;
r = txn->commit_with_progress(txn, flags, txn_progress_func, &info);
int r = txn->commit_with_progress(txn, flags, txn_progress_func, &info);
if (r != 0) {
sql_print_error("tried committing transaction %p and got error code %d", txn, r);
}
assert(r == 0);
thd_proc_info(thd, orig_proc_info);
}
static void abort_txn_with_progress(DB_TXN* txn, THD* thd) {
int r;
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
struct txn_progress_info info;
info.thd = thd;
r = txn->abort_with_progress(txn, txn_progress_func, &info);
int r = txn->abort_with_progress(txn, txn_progress_func, &info);
if (r != 0) {
sql_print_error("tried aborting transaction %p and got error code %d", txn, r);
}
assert(r == 0);
thd_proc_info(thd, orig_proc_info);
}
static void tokudb_cleanup_handlers(tokudb_trx_data *trx, DB_TXN *txn) {
......
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