Commit b8c3131f authored by Rich Prohaska's avatar Rich Prohaska

DB-735 use thd_killed

parent 1275a85b
...@@ -471,7 +471,7 @@ typedef struct index_read_info { ...@@ -471,7 +471,7 @@ typedef struct 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 (thd_killed(context->thd)) {
sprintf(context->write_status_msg, "The process has been killed, aborting add index."); sprintf(context->write_status_msg, "The process has been killed, aborting add index.");
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
} }
...@@ -486,7 +486,7 @@ static int ai_poll_fun(void *extra, float progress) { ...@@ -486,7 +486,7 @@ static int ai_poll_fun(void *extra, float progress) {
static int loader_poll_fun(void *extra, float progress) { static int loader_poll_fun(void *extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra; 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."); sprintf(context->write_status_msg, "The process has been killed, aborting bulk load.");
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
} }
...@@ -3316,7 +3316,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ...@@ -3316,7 +3316,7 @@ int ha_tokudb::end_bulk_insert(bool abort) {
ai_metadata_update_required = false; ai_metadata_update_required = false;
loader_error = 0; loader_error = 0;
if (loader) { if (loader) {
if (!abort_loader && !thd->killed) { if (!abort_loader && !thd_killed(thd)) {
DBUG_EXECUTE_IF("tokudb_end_bulk_insert_sleep", { DBUG_EXECUTE_IF("tokudb_end_bulk_insert_sleep", {
const char *orig_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");
...@@ -3326,7 +3326,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ...@@ -3326,7 +3326,7 @@ int ha_tokudb::end_bulk_insert(bool abort) {
error = loader->close(loader); error = loader->close(loader);
loader = NULL; loader = NULL;
if (error) { if (error) {
if (thd->killed) { if (thd_killed(thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0)); my_error(ER_QUERY_INTERRUPTED, MYF(0));
} }
goto cleanup; goto cleanup;
...@@ -3461,7 +3461,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in ...@@ -3461,7 +3461,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in
share->rows, share->rows,
key_info->name); key_info->name);
thd_proc_info(thd, status_msg); thd_proc_info(thd, status_msg);
if (thd->killed) { if (thd_killed(thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0)); my_error(ER_QUERY_INTERRUPTED, MYF(0));
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
goto cleanup; goto cleanup;
...@@ -7712,7 +7712,7 @@ int ha_tokudb::tokudb_add_index( ...@@ -7712,7 +7712,7 @@ int ha_tokudb::tokudb_add_index(
thd_progress_report(thd, num_processed, (long long unsigned) share->rows); thd_progress_report(thd, num_processed, (long long unsigned) share->rows);
#endif #endif
if (thd->killed) { if (thd_killed(thd)) {
error = ER_ABORTING_CONNECTION; error = ER_ABORTING_CONNECTION;
goto cleanup; goto cleanup;
} }
......
...@@ -102,7 +102,7 @@ struct analyze_progress_extra { ...@@ -102,7 +102,7 @@ struct analyze_progress_extra {
static int analyze_progress(void *v_extra, uint64_t rows) { static int analyze_progress(void *v_extra, uint64_t rows) {
struct analyze_progress_extra *extra = (struct analyze_progress_extra *) v_extra; struct analyze_progress_extra *extra = (struct analyze_progress_extra *) v_extra;
THD *thd = extra->thd; THD *thd = extra->thd;
if (thd->killed) if (thd_killed(thd))
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
time_t t_now = time(0); time_t t_now = time(0);
...@@ -190,7 +190,7 @@ typedef struct hot_optimize_context { ...@@ -190,7 +190,7 @@ typedef struct hot_optimize_context {
static int hot_poll_fun(void *extra, float progress) { static int hot_poll_fun(void *extra, float progress) {
HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra; 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."); sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize.");
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
} }
...@@ -271,7 +271,7 @@ struct check_context { ...@@ -271,7 +271,7 @@ struct check_context {
static int ha_tokudb_check_progress(void *extra, float progress) { static int ha_tokudb_check_progress(void *extra, float progress) {
struct check_context *context = (struct check_context *) extra; struct check_context *context = (struct check_context *) extra;
int result = 0; int result = 0;
if (context->thd->killed) if (thd_killed(context->thd))
result = ER_ABORTING_CONNECTION; result = ER_ABORTING_CONNECTION;
return result; return result;
} }
......
...@@ -1522,7 +1522,7 @@ static int tokudb_file_map(TABLE *table, THD *thd) { ...@@ -1522,7 +1522,7 @@ static int tokudb_file_map(TABLE *table, THD *thd) {
error = schema_table_store_record(thd, table); error = schema_table_store_record(thd, table);
} }
if (!error && thd->killed) if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
...@@ -1669,7 +1669,7 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) { ...@@ -1669,7 +1669,7 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) {
if (!error) { if (!error) {
error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd); 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; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
...@@ -1884,7 +1884,7 @@ static int tokudb_fractal_tree_block_map(TABLE *table, THD *thd) { ...@@ -1884,7 +1884,7 @@ static int tokudb_fractal_tree_block_map(TABLE *table, THD *thd) {
if (!error) { if (!error) {
error = tokudb_report_fractal_tree_block_map_for_db(&curr_key, &curr_val, table, thd); 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; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
...@@ -2054,7 +2054,7 @@ static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_ ...@@ -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[0]->store(txn_id, false);
table->field[1]->store(client_id, false); table->field[1]->store(client_id, false);
int error = schema_table_store_record(thd, table); int error = schema_table_store_record(thd, table);
if (!error && thd->killed) if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
return error; return error;
} }
...@@ -2140,7 +2140,7 @@ static int tokudb_lock_waits_callback(DB *db, uint64_t requesting_txnid, const D ...@@ -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); int error = schema_table_store_record(thd, table);
if (!error && thd->killed) if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
return error; return error;
...@@ -2231,7 +2231,7 @@ static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_ro ...@@ -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); error = schema_table_store_record(thd, table);
if (!error && thd->killed) if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
return error; return error;
......
...@@ -481,12 +481,12 @@ static uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) { ...@@ -481,12 +481,12 @@ static uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) {
static int tokudb_killed_callback(void) { static int tokudb_killed_callback(void) {
THD *thd = current_thd; THD *thd = current_thd;
return thd->killed; return thd_killed(thd);
} }
static bool tokudb_killed_thd_callback(void *extra) { static bool tokudb_killed_thd_callback(void *extra) {
THD *thd = static_cast<THD *>(extra); THD *thd = static_cast<THD *>(extra);
return thd->killed != 0; return thd_killed(thd) != 0;
} }
enum { enum {
......
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