Commit 021f78f6 authored by Kristian Nielsen's avatar Kristian Nielsen

Use thd_kill_level() over old thd_killed() in TokuDB.

parent 660a2928
...@@ -533,7 +533,7 @@ typedef struct index_read_info { ...@@ -533,7 +533,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 (thd_killed(context->thd)) { if (thd_kill_level(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;
} }
...@@ -548,7 +548,7 @@ static int ai_poll_fun(void *extra, float progress) { ...@@ -548,7 +548,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 (thd_killed(context->thd)) { if (thd_kill_level(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;
} }
...@@ -3435,7 +3435,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ...@@ -3435,7 +3435,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(thd)) { if (!abort_loader && !thd_kill_level(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");
...@@ -3445,7 +3445,7 @@ int ha_tokudb::end_bulk_insert(bool abort) { ...@@ -3445,7 +3445,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(thd)) { if (thd_kill_level(thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0)); my_error(ER_QUERY_INTERRUPTED, MYF(0));
} }
goto cleanup; goto cleanup;
...@@ -3580,7 +3580,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in ...@@ -3580,7 +3580,7 @@ int ha_tokudb::is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_in
share->row_count(), share->row_count(),
key_info->name); key_info->name);
thd_proc_info(thd, status_msg); thd_proc_info(thd, status_msg);
if (thd_killed(thd)) { if (thd_kill_level(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;
...@@ -5245,7 +5245,7 @@ int ha_tokudb::fill_range_query_buf( ...@@ -5245,7 +5245,7 @@ int ha_tokudb::fill_range_query_buf(
// otherwise, if we simply see that the current key is no match, // otherwise, if we simply see that the current key is no match,
// we tell the cursor to continue and don't store // we tell the cursor to continue and don't store
// the key locally // the key locally
if (result == ICP_OUT_OF_RANGE || thd_killed(thd)) { if (result == ICP_OUT_OF_RANGE || thd_kill_level(thd)) {
icp_went_out_of_range = true; icp_went_out_of_range = true;
error = 0; error = 0;
DEBUG_SYNC(ha_thd(), "tokudb_icp_asc_scan_out_of_range"); DEBUG_SYNC(ha_thd(), "tokudb_icp_asc_scan_out_of_range");
...@@ -5613,7 +5613,7 @@ int ha_tokudb::get_next( ...@@ -5613,7 +5613,7 @@ int ha_tokudb::get_next(
static_cast<tokudb_trx_data*>(thd_get_ha_data(thd, tokudb_hton)); static_cast<tokudb_trx_data*>(thd_get_ha_data(thd, tokudb_hton));
trx->stmt_progress.queried++; trx->stmt_progress.queried++;
track_progress(thd); track_progress(thd);
if (thd_killed(thd)) if (thd_kill_level(thd))
error = ER_ABORTING_CONNECTION; error = ER_ABORTING_CONNECTION;
} }
cleanup: cleanup:
...@@ -8351,7 +8351,7 @@ int ha_tokudb::tokudb_add_index( ...@@ -8351,7 +8351,7 @@ int ha_tokudb::tokudb_add_index(
(long long unsigned)share->row_count()); (long long unsigned)share->row_count());
#endif #endif
if (thd_killed(thd)) { if (thd_kill_level(thd)) {
error = ER_ABORTING_CONNECTION; error = ER_ABORTING_CONNECTION;
goto cleanup; goto cleanup;
} }
......
...@@ -225,7 +225,7 @@ int recount_rows_t::analyze_recount_rows_progress( ...@@ -225,7 +225,7 @@ int recount_rows_t::analyze_recount_rows_progress(
_ticks = 0; _ticks = 0;
uint64_t now = tokudb::time::microsec(); uint64_t now = tokudb::time::microsec();
_total_elapsed_time = now - _recount_start; _total_elapsed_time = now - _recount_start;
if ((_thd && thd_killed(_thd)) || cancelled()) { if ((_thd && thd_kill_level(_thd)) || cancelled()) {
// client killed // client killed
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
} }
...@@ -540,7 +540,7 @@ int standard_t::analyze_key_progress(void) { ...@@ -540,7 +540,7 @@ int standard_t::analyze_key_progress(void) {
uint64_t now = tokudb::time::microsec(); uint64_t now = tokudb::time::microsec();
_total_elapsed_time = now - _analyze_start; _total_elapsed_time = now - _analyze_start;
_key_elapsed_time = now - _analyze_key_start; _key_elapsed_time = now - _analyze_key_start;
if ((_thd && thd_killed(_thd)) || cancelled()) { if ((_thd && thd_kill_level(_thd)) || cancelled()) {
// client killed // client killed
return ER_ABORTING_CONNECTION; return ER_ABORTING_CONNECTION;
} else if (_time_limit > 0 && } else if (_time_limit > 0 &&
...@@ -876,7 +876,7 @@ typedef struct hot_optimize_context { ...@@ -876,7 +876,7 @@ typedef struct hot_optimize_context {
static int hot_optimize_progress_fun(void *extra, float progress) { static int hot_optimize_progress_fun(void *extra, float progress) {
HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra; HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra;
if (thd_killed(context->thd)) { if (thd_kill_level(context->thd)) {
sprintf( sprintf(
context->write_status_msg, context->write_status_msg,
"The process has been killed, aborting hot optimize."); "The process has been killed, aborting hot optimize.");
...@@ -1003,7 +1003,7 @@ struct check_context { ...@@ -1003,7 +1003,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 (thd_killed(context->thd)) if (thd_kill_level(context->thd))
result = ER_ABORTING_CONNECTION; result = ER_ABORTING_CONNECTION;
return result; return result;
} }
......
...@@ -172,12 +172,12 @@ inline uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) { ...@@ -172,12 +172,12 @@ inline uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) {
inline int tokudb_killed_callback(void) { inline int tokudb_killed_callback(void) {
THD *thd = current_thd; THD *thd = current_thd;
return thd_killed(thd); return thd_kill_level(thd);
} }
inline bool tokudb_killed_thd_callback(void *extra, uint64_t deleted_rows) { inline bool tokudb_killed_thd_callback(void *extra, uint64_t deleted_rows) {
THD *thd = static_cast<THD *>(extra); THD *thd = static_cast<THD *>(extra);
return thd_killed(thd) != 0; return thd_kill_level(thd) != 0;
} }
......
...@@ -87,7 +87,7 @@ int trx_callback( ...@@ -87,7 +87,7 @@ int trx_callback(
uint64_t tnow = (uint64_t) ::time(NULL); uint64_t tnow = (uint64_t) ::time(NULL);
table->field[2]->store(tnow >= start_time ? tnow - start_time : 0, false); table->field[2]->store(tnow >= start_time ? tnow - start_time : 0, false);
int error = schema_table_store_record(thd, table); int error = schema_table_store_record(thd, table);
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
return error; return error;
} }
...@@ -221,7 +221,7 @@ int lock_waits_callback( ...@@ -221,7 +221,7 @@ int lock_waits_callback(
int error = schema_table_store_record(thd, table); int error = schema_table_store_record(thd, table);
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
return error; return error;
...@@ -365,7 +365,7 @@ int locks_callback( ...@@ -365,7 +365,7 @@ int locks_callback(
error = schema_table_store_record(thd, table); error = schema_table_store_record(thd, table);
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
return error; return error;
...@@ -497,7 +497,7 @@ int report_file_map(TABLE* table, THD* thd) { ...@@ -497,7 +497,7 @@ int report_file_map(TABLE* table, THD* thd) {
error = schema_table_store_record(thd, table); error = schema_table_store_record(thd, table);
} }
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
...@@ -702,7 +702,7 @@ int report_fractal_tree_info(TABLE* table, THD* thd) { ...@@ -702,7 +702,7 @@ int report_fractal_tree_info(TABLE* table, THD* thd) {
if (error) if (error)
error = 0; // ignore read uncommitted errors error = 0; // ignore read uncommitted errors
} }
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
...@@ -993,7 +993,7 @@ int report_fractal_tree_block_map(TABLE* table, THD* thd) { ...@@ -993,7 +993,7 @@ int report_fractal_tree_block_map(TABLE* table, THD* thd) {
table, table,
thd); thd);
} }
if (!error && thd_killed(thd)) if (!error && thd_kill_level(thd))
error = ER_QUERY_INTERRUPTED; error = ER_QUERY_INTERRUPTED;
} }
if (error == DB_NOTFOUND) { if (error == DB_NOTFOUND) {
......
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