From b8c3131f10ca405601fc82f48364d6fe5c02eb14 Mon Sep 17 00:00:00 2001 From: Rich Prohaska Date: Wed, 8 Oct 2014 12:01:06 -0400 Subject: [PATCH] DB-735 use thd_killed --- storage/tokudb/ha_tokudb.cc | 12 ++++++------ storage/tokudb/ha_tokudb_admin.cc | 6 +++--- storage/tokudb/hatoku_hton.cc | 12 ++++++------ storage/tokudb/hatoku_hton.h | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index d472f1259e0..d9b11dbba3e 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -471,7 +471,7 @@ typedef struct index_read_info { static int ai_poll_fun(void *extra, float progress) { LOADER_CONTEXT context = (LOADER_CONTEXT)extra; - if (context->thd->killed) { + if (thd_killed(context->thd)) { sprintf(context->write_status_msg, "The process has been killed, aborting add index."); return ER_ABORTING_CONNECTION; } @@ -486,7 +486,7 @@ static int ai_poll_fun(void *extra, float progress) { static int loader_poll_fun(void *extra, float progress) { LOADER_CONTEXT context = (LOADER_CONTEXT)extra; - if (context->thd->killed) { + if (thd_killed(context->thd)) { sprintf(context->write_status_msg, "The process has been killed, aborting bulk load."); return ER_ABORTING_CONNECTION; } @@ -3316,7 +3316,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ai_metadata_update_required = false; loader_error = 0; if (loader) { - if (!abort_loader && !thd->killed) { + if (!abort_loader && !thd_killed(thd)) { DBUG_EXECUTE_IF("tokudb_end_bulk_insert_sleep", { const char *orig_proc_info = tokudb_thd_get_proc_info(thd); thd_proc_info(thd, "DBUG sleep"); @@ -3326,7 +3326,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { error = loader->close(loader); loader = NULL; if (error) { - if (thd->killed) { + if (thd_killed(thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); } goto cleanup; @@ -3461,7 +3461,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in share->rows, key_info->name); thd_proc_info(thd, status_msg); - if (thd->killed) { + if (thd_killed(thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); error = ER_QUERY_INTERRUPTED; goto cleanup; @@ -7712,7 +7712,7 @@ int ha_tokudb::tokudb_add_index( thd_progress_report(thd, num_processed, (long long unsigned) share->rows); #endif - if (thd->killed) { + if (thd_killed(thd)) { error = ER_ABORTING_CONNECTION; goto cleanup; } diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index 100c88a76a8..8fe17e1dfca 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -102,7 +102,7 @@ struct analyze_progress_extra { static int analyze_progress(void *v_extra, uint64_t rows) { struct analyze_progress_extra *extra = (struct analyze_progress_extra *) v_extra; THD *thd = extra->thd; - if (thd->killed) + if (thd_killed(thd)) return ER_ABORTING_CONNECTION; time_t t_now = time(0); @@ -190,7 +190,7 @@ typedef struct hot_optimize_context { static int hot_poll_fun(void *extra, float progress) { HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra; - if (context->thd->killed) { + if (thd_killed(context->thd)) { sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize."); return ER_ABORTING_CONNECTION; } @@ -271,7 +271,7 @@ struct check_context { static int ha_tokudb_check_progress(void *extra, float progress) { struct check_context *context = (struct check_context *) extra; int result = 0; - if (context->thd->killed) + if (thd_killed(context->thd)) result = ER_ABORTING_CONNECTION; return result; } diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index 3c5d7f73357..2d4653fdf4b 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -1522,7 +1522,7 @@ static int tokudb_file_map(TABLE *table, THD *thd) { error = schema_table_store_record(thd, table); } - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; } if (error == DB_NOTFOUND) { @@ -1669,7 +1669,7 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) { if (!error) { error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd); } - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; } if (error == DB_NOTFOUND) { @@ -1884,7 +1884,7 @@ static int tokudb_fractal_tree_block_map(TABLE *table, THD *thd) { if (!error) { error = tokudb_report_fractal_tree_block_map_for_db(&curr_key, &curr_val, table, thd); } - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; } if (error == DB_NOTFOUND) { @@ -2054,7 +2054,7 @@ static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_ table->field[0]->store(txn_id, false); table->field[1]->store(client_id, false); int error = schema_table_store_record(thd, table); - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; return error; } @@ -2140,7 +2140,7 @@ static int tokudb_lock_waits_callback(DB *db, uint64_t requesting_txnid, const D int error = schema_table_store_record(thd, table); - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; return error; @@ -2231,7 +2231,7 @@ static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_ro error = schema_table_store_record(thd, table); - if (!error && thd->killed) + if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; } return error; diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h index 2a5d15d4700..9169e36f158 100644 --- a/storage/tokudb/hatoku_hton.h +++ b/storage/tokudb/hatoku_hton.h @@ -481,12 +481,12 @@ static uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) { static int tokudb_killed_callback(void) { THD *thd = current_thd; - return thd->killed; + return thd_killed(thd); } static bool tokudb_killed_thd_callback(void *extra) { THD *thd = static_cast(extra); - return thd->killed != 0; + return thd_killed(thd) != 0; } enum {