Commit ee2a0724 authored by Rich Prohaska's avatar Rich Prohaska

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

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