diff options
author | unknown <hf@deer.mysql.r18.ru> | 2003-04-08 19:18:33 +0500 |
---|---|---|
committer | unknown <hf@deer.mysql.r18.ru> | 2003-04-08 19:18:33 +0500 |
commit | 131d90001f2eca14d3497207b57fcd484c3f8927 (patch) | |
tree | 295ae18e0819b1fd8547ac14b570335446f7353a | |
parent | 21f1b11fa8949feda9fe7147725e78161d344b04 (diff) | |
download | mariadb-git-131d90001f2eca14d3497207b57fcd484c3f8927.tar.gz |
SCRUM
two KILL versions
code trimming with headquarter's suggestions
myisam/mi_check.c:
killed_ptr function changed backward
myisam/myisamchk.c:
killed_ptr function changed backward
myisam/myisamdef.h:
killed_ptr function changed backward
myisam/sort.c:
killed_ptr function changed backward
sql/ha_myisam.cc:
killed_ptr function changed backward
sql/lock.cc:
error sending trimmed
sql/log_event.cc:
error sending trimmed
sql/records.cc:
error sending trimmed
sql/slave.cc:
error sending trimmed
sql/sql_class.h:
inline functions to send right message about killing added
sql/sql_delete.cc:
error sending trimmed
sql/sql_load.cc:
error sending trimmed
sql/sql_parse.cc:
error sending trimmed
sql/sql_prepare.cc:
error sending trimmed
sql/sql_select.cc:
error sending trimmed
sql/sql_table.cc:
error sending trimmed
sql/sql_update.cc:
error sending trimmed
-rw-r--r-- | myisam/mi_check.c | 2 | ||||
-rw-r--r-- | myisam/myisamchk.c | 4 | ||||
-rw-r--r-- | myisam/myisamdef.h | 2 | ||||
-rw-r--r-- | myisam/sort.c | 4 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 4 | ||||
-rw-r--r-- | sql/lock.cc | 2 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/records.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 8 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 | ||||
-rw-r--r-- | sql/sql_load.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 20 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 |
17 files changed, 39 insertions, 31 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 23d477fb140..197739c0631 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -2585,7 +2585,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) char llbuff[22],llbuff2[22]; DBUG_ENTER("sort_get_next_record"); - if (killed_ptr(param->thd)) + if (*killed_ptr(param->thd)) DBUG_RETURN(1); switch (share->data_file_type) { diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index d816cd3f2a2..b0eade99a3d 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -1644,9 +1644,9 @@ err: DBUG_RETURN(1); } /* sort_record_index */ -bool killed_ptr(void *thd) +int *killed_ptr(void *thd) { - return (bool)thd; /* always NULL */ + return (int *)thd; /* always NULL */ } /* print warnings and errors */ diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index b2d6807ad73..6886554d94e 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -693,7 +693,7 @@ int mi_open_keyfile(MYISAM_SHARE *share); void mi_setup_functions(register MYISAM_SHARE *share); /* Functions needed by mi_check */ -bool killed_ptr(void *thd); +int *killed_ptr(void *thd); void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); diff --git a/myisam/sort.c b/myisam/sort.c index 1913af650c0..73c5b414edf 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -844,7 +844,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, uchar *strpos; BUFFPEK *buffpek,**refpek; QUEUE queue; - void *thd= info->sort_info->param->thd; + int *killed= killed_ptr(info->sort_info->param->thd); DBUG_ENTER("merge_buffers"); @@ -876,7 +876,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, { for (;;) { - if (killed_ptr(thd)) + if (*killed) { error=1; goto err; } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 69b6e248ac5..10574a15e3a 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -89,9 +89,9 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, extern "C" { -bool killed_ptr(void *thd) +int *killed_ptr(void *thd) { - return ((THD *)thd)->killed; + return (int*)&((THD *)thd)->killed; } void mi_check_print_error(MI_CHECK *param, const char *fmt,...) diff --git a/sql/lock.cc b/sql/lock.cc index 9e399a364b2..45ffefed14f 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -154,7 +154,7 @@ retry: thd->proc_info=0; if (thd->killed) { - my_error(thd->killed, MYF(0)); + thd->send_kill_message(); if (sql_lock) { mysql_unlock_tables(thd,sql_lock); diff --git a/sql/log_event.cc b/sql/log_event.cc index 5132388224f..b533ddb126a 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -779,7 +779,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), data_buf(0), query(query_arg), db(thd_arg->db), q_len((uint32) query_length), - error_code((int)thd_arg->killed ? (int)thd_arg->killed : thd_arg->net.last_errno), + error_code(thd_arg->killed != THD::NOT_KILLED ? thd->killed_errno() : thd_arg->net.last_errno), thread_id(thd_arg->thread_id) { time_t end_time; diff --git a/sql/records.cc b/sql/records.cc index 38904fa405f..2efd331b048 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -154,7 +154,7 @@ static int rr_sequential(READ_RECORD *info) { if (info->thd->killed) { - my_error(info->thd->killed,MYF(0)); + info->thd->send_kill_message(); return 1; } if (tmp != HA_ERR_RECORD_DELETED) diff --git a/sql/slave.cc b/sql/slave.cc index 78b415503f9..e6f7c5eac54 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -559,7 +559,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, if (thd->killed) { pthread_mutex_unlock(cond_lock); - DBUG_RETURN(thd->killed); + DBUG_RETURN(thd->killed_errno()); } } } @@ -1861,7 +1861,7 @@ err: pthread_mutex_unlock(&data_lock); DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d \ improper_arguments: %d timed_out: %d", - (int) thd->killed, + thd->killed_errno(), (int) (init_abort_pos_wait != abort_pos_wait), (int) mi->slave_running, (int) (error == -2), diff --git a/sql/sql_class.h b/sql/sql_class.h index 96a3bb7051f..605d86e9684 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -527,6 +527,14 @@ public: enum killed_state { NOT_KILLED=0, KILL_CONNECTION=ER_SERVER_SHUTDOWN, KILL_QUERY=ER_QUERY_INTERRUPTED }; killed_state volatile killed; + inline int killed_errno() const + { + return killed; + } + inline void send_kill_message() const + { + my_error(killed_errno(), MYF(0)); + } bool prepare_command; bool tmp_table_used; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 921854469a5..392b81ba30b 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -212,7 +212,7 @@ cleanup: delete select; free_underlaid_joins(thd, &thd->lex.select_lex); if (error >= 0 || thd->net.report_error) - send_error(thd,thd->killed); + send_error(thd,thd->killed_errno()); else { send_ok(thd,deleted); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 69585ddbc77..b7f007fa7ba 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -379,7 +379,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, { if (thd->killed) { - my_error(thd->killed,MYF(0)); + thd->send_kill_message(); DBUG_RETURN(1); } it.rewind(); @@ -453,7 +453,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, { if (thd->killed) { - my_error(thd->killed,MYF(0)); + thd->send_kill_message(); DBUG_RETURN(1); } while ((sql_field=(Item_field*) it++)) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5f99163b33c..6b604644450 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1658,7 +1658,7 @@ mysql_execute_command(THD *thd) cursor))) { if (res < 0 || thd->net.report_error) - send_error(thd,thd->killed); + send_error(thd,thd->killed_errno()); DBUG_RETURN(res); } } @@ -3141,7 +3141,7 @@ mysql_execute_command(THD *thd) // We end up here if res == 0 and send_ok() has been done, // or res != 0 and no send_error() has yet been done. if (res < 0) - send_error(thd,thd->killed); + send_error(thd,thd->killed_errno()); DBUG_RETURN(res); error: diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 1d5e78b5e69..5ed8159793a 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -674,7 +674,7 @@ static bool send_prepare_results(PREP_STMT *stmt) DBUG_RETURN(0); abort: - send_error(thd,thd->killed); + send_error(thd,thd->killed_errno()); DBUG_RETURN(1); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f6b5372812b..cbf30126272 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1725,7 +1725,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, sizeof(POSITION)*join->const_tables); join->best_read=1.0; } - DBUG_RETURN(join->thd->killed || get_best_combination(join)); + DBUG_RETURN(join->thd->killed_errno() || get_best_combination(join)); } @@ -4978,7 +4978,7 @@ sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) } if (join->thd->killed) // If aborted by user { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); return -2; /* purecov: inspected */ } if (join_tab->use_quick != 2 || test_if_quick_select(join_tab) <= 0) @@ -5017,7 +5017,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) { if (join->thd->killed) // Aborted by user { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); return -2; /* purecov: inspected */ } join->examined_rows++; @@ -5097,7 +5097,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skipp_last) { if (join->thd->killed) { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); return -2; // Aborted by user /* purecov: inspected */ } SQL_SELECT *select=join_tab->select; @@ -5745,7 +5745,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (join->thd->killed) // Aborted by user { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); DBUG_RETURN(-2); /* purecov: inspected */ } if (!end_of_records) @@ -5813,7 +5813,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), DBUG_RETURN(0); if (join->thd->killed) // Aborted by user { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); DBUG_RETURN(-2); /* purecov: inspected */ } @@ -5883,7 +5883,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), DBUG_RETURN(0); if (join->thd->killed) // Aborted by user { - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); DBUG_RETURN(-2); /* purecov: inspected */ } @@ -5930,7 +5930,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (join->thd->killed) { // Aborted by user - my_error(join->thd->killed,MYF(0)); /* purecov: inspected */ + join->thd->send_kill_message(); DBUG_RETURN(-2); /* purecov: inspected */ } if (!join->first_record || end_of_records || @@ -6652,7 +6652,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, { if (thd->killed) { - my_error(thd->killed,MYF(0)); + thd->send_kill_message(); error=0; goto err; } @@ -6764,7 +6764,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, { if (thd->killed) { - my_error(thd->killed,MYF(0)); + thd->send_kill_message(); error=0; goto err; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 6473fe7f961..27db0ea0827 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2381,7 +2381,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, { if (thd->killed) { - my_error(thd->killed,MYF(0)); + thd->send_kill_message(); error= 1; break; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 23783883502..4ad14da242e 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -357,7 +357,7 @@ int mysql_update(THD *thd, delete select; free_underlaid_joins(thd, &thd->lex.select_lex); if (error >= 0) - send_error(thd,thd->killed); /* purecov: inspected */ + send_error(thd,thd->killed_errno()); /* purecov: inspected */ else { char buff[80]; |