diff options
author | unknown <hf@deer.mysql.r18.ru> | 2003-04-08 19:43:24 +0500 |
---|---|---|
committer | unknown <hf@deer.mysql.r18.ru> | 2003-04-08 19:43:24 +0500 |
commit | bbcf5390d6f2126bd4d13717cabb47d2a07c5cb9 (patch) | |
tree | 01d8c458001514d5c89684a3b748ad31483c8557 /sql | |
parent | cfd69393e4195e55412778a9d60c7eb99c87de4c (diff) | |
parent | 131d90001f2eca14d3497207b57fcd484c3f8927 (diff) | |
download | mariadb-git-bbcf5390d6f2126bd4d13717cabb47d2a07c5cb9.tar.gz |
Merging
myisam/mi_check.c:
Auto merged
myisam/sort.c:
Auto merged
sql/filesort.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/lex.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
include/mysqld_error.h:
error messages trimmed
sql/share/czech/errmsg.txt:
error messages trimmed
sql/share/danish/errmsg.txt:
error messages trimmed
sql/share/dutch/errmsg.txt:
error messages trimmed
sql/share/english/errmsg.txt:
error messages trimmed
sql/share/estonian/errmsg.txt:
error messages trimmed
sql/share/french/errmsg.txt:
error messages trimmed
sql/share/german/errmsg.txt:
error messages trimmed
sql/share/greek/errmsg.txt:
error messages trimmed
sql/share/hungarian/errmsg.txt:
error messages trimmed
sql/share/italian/errmsg.txt:
error messages trimmed
sql/share/japanese/errmsg.txt:
error messages trimmed
sql/share/korean/errmsg.txt:
error messages trimmed
sql/share/norwegian-ny/errmsg.txt:
error messages trimmed
sql/share/norwegian/errmsg.txt:
error messages trimmed
sql/share/polish/errmsg.txt:
error messages trimmed
sql/share/portuguese/errmsg.txt:
error messages trimmed
sql/share/romanian/errmsg.txt:
error messages trimmed
sql/share/russian/errmsg.txt:
error messages trimmed
sql/share/serbian/errmsg.txt:
error messages trimmed
sql/share/slovak/errmsg.txt:
error messages trimmed
sql/share/spanish/errmsg.txt:
error messages trimmed
sql/share/swedish/errmsg.txt:
error messages trimmed
sql/share/ukrainian/errmsg.txt:
error messages trimmed
Diffstat (limited to 'sql')
49 files changed, 109 insertions, 64 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 4c2ba1e1a59..5a5152d5435 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -278,7 +278,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH]; my_off_t record; TABLE *sort_form; - volatile bool *killed= ¤t_thd->killed; + volatile THD::killed_state *killed= ¤t_thd->killed; handler *file; DBUG_ENTER("find_all_keys"); DBUG_PRINT("info",("using: %s",(select?select->quick?"ranges":"where":"every row"))); @@ -689,15 +689,15 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, BUFFPEK *buffpek,**refpek; QUEUE queue; qsort2_cmp cmp; - volatile bool *killed= ¤t_thd->killed; - bool not_killable; + volatile THD::killed_state *killed= ¤t_thd->killed; + THD::killed_state not_killable; DBUG_ENTER("merge_buffers"); statistic_increment(filesort_merge_passes, &LOCK_status); if (param->not_killable) { killed= ¬_killable; - not_killable=0; + not_killable=THD::NOT_KILLED; } error=0; diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index dbed955c0a9..9057e21d4c2 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -2103,7 +2103,7 @@ static void print_msg(THD *thd, const char *table_name, const char *op_name, protocol->store(msg_type); protocol->store(msgbuf); if (protocol->write()) - thd->killed=1; + thd->killed=THD::KILL_CONNECTION; } #endif diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 213f5baf388..90c5c4a0eb7 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" { -volatile bool *killed_ptr(MI_CHECK *param) +int *killed_ptr(void *thd) { - return &(((THD *)(param->thd))->killed); + return (int*)&((THD *)thd)->killed; } void mi_check_print_error(MI_CHECK *param, const char *fmt,...) diff --git a/sql/lex.h b/sql/lex.h index ff30b599ded..589db9abd91 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -104,6 +104,7 @@ static SYMBOL symbols[] = { { "COMMITTED", SYM(COMMITTED_SYM),0,0}, { "COMPRESSED", SYM(COMPRESSED_SYM),0,0}, { "CONCURRENT", SYM(CONCURRENT),0,0}, + { "CONNECTION", SYM(CONNECTION_SYM),0,0}, { "CONSTRAINT", SYM(CONSTRAINT),0,0}, { "CREATE", SYM(CREATE),0,0}, { "CROSS", SYM(CROSS),0,0}, diff --git a/sql/lock.cc b/sql/lock.cc index 82004298453..45ffefed14f 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -154,7 +154,7 @@ retry: thd->proc_info=0; if (thd->killed) { - my_error(ER_SERVER_SHUTDOWN,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 d4efb65bf42..151b031ed55 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(thd_arg->killed ? ER_SERVER_SHUTDOWN: 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/mysql_priv.h b/sql/mysql_priv.h index c57f40cbf20..9aebea5bef3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -45,7 +45,7 @@ char *sql_strdup(const char *str); char *sql_strmake(const char *str,uint len); gptr sql_memdup(const void * ptr,unsigned size); void sql_element_free(void *ptr); -void kill_one_thread(THD *thd, ulong id); +void kill_one_thread(THD *thd, ulong id, bool only_kill_query); bool net_request_file(NET* net, const char* fname); char* query_table_status(THD *thd,const char *db,const char *table_name); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d33ea108b34..f4d9b65551c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -634,7 +634,7 @@ static void close_connections(void) { DBUG_PRINT("quit",("Informing thread %ld that it's time to die", tmp->thread_id)); - tmp->killed=1; + tmp->killed= THD::KILL_CONNECTION; if (tmp->mysys_var) { tmp->mysys_var->abort=1; @@ -1394,7 +1394,7 @@ extern "C" sig_handler abort_thread(int sig __attribute__((unused))) THD *thd=current_thd; DBUG_ENTER("abort_thread"); if (thd) - thd->killed=1; + thd->killed= THD::KILL_CONNECTION; DBUG_VOID_RETURN; } #endif @@ -2852,7 +2852,7 @@ static void create_new_thread(THD *thd) ("Can't create thread to handle request (error %d)", error)); thread_count--; - thd->killed=1; // Safety + thd->killed= THD::KILL_CONNECTION; // Safety (void) pthread_mutex_unlock(&LOCK_thread_count); net_printf(thd,ER_CANT_CREATE_THREAD,error); (void) pthread_mutex_lock(&LOCK_thread_count); diff --git a/sql/records.cc b/sql/records.cc index 22c4d54550c..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(ER_SERVER_SHUTDOWN,MYF(0)); + info->thd->send_kill_message(); return 1; } if (tmp != HA_ERR_RECORD_DELETED) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 4cdefe79ea9..b1c79b5f711 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -279,3 +279,4 @@ v/* "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 5abb56b9a3f..d20ab6f55ce 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -273,3 +273,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 897584131a3..eff34b1165f 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -281,3 +281,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index fbd4cc7e06d..a5a90178dee 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 65ed5e41766..7f02c7dd67c 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -275,3 +275,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 553e1f6323e..f4e0cc6837e 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index e7cb18db762..9c796c59d37 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -279,3 +279,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 1d568c3dd50..6fd51c17123 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index ff8b8f04c00..bd771634b16 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -272,3 +272,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index bbc39fe9e2a..65496e5f3df 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 2b8fe1e0957..f385279036b 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -272,3 +272,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 71c8b621bc6..7ff6897a466 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index cc2a88acb73..f6c5e6e11c8 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -272,3 +272,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 1321b866c18..07120e7e844 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -272,3 +272,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index f7715d4d693..6671d896f41 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -274,3 +274,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 254d6df7f5b..7508ab82fca 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 5157856e1c5..acbd40a9247 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -274,3 +274,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 54c69083938..6c3b0ba33af 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -272,3 +272,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index f19100df5f9..e9e01513a34 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -266,3 +266,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 8656eb7cd32..53c8d2727ed 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -278,3 +278,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index e6fb082dab2..d1b7a6e447a 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -271,3 +271,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index c4a4572ac67..3d01d2e5287 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -270,3 +270,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index bd906da957c..c63b103bd48 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -275,3 +275,4 @@ "Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION" "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored." "The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." +"Query execution was interrupted" diff --git a/sql/slave.cc b/sql/slave.cc index fa7ab180eaa..d92b89098d5 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(ER_SERVER_SHUTDOWN); + 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_base.cc b/sql/sql_base.cc index 2063e8b3f08..92aa7b9b07f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2413,7 +2413,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, /* Kill delayed insert threads */ if (in_use->system_thread && ! in_use->killed) { - in_use->killed=1; + in_use->killed= THD::KILL_CONNECTION; pthread_mutex_lock(&in_use->mysys_var->mutex); if (in_use->mysys_var->current_cond) { diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 664df11a968..4083249a022 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2929,7 +2929,7 @@ void Query_cache::wreck(uint line, const char *message) DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line)); DBUG_PRINT("warning", ("==================================")); if (thd) - thd->killed = 1; + thd->killed= THD::KILL_CONNECTION; cache_dump(); /* check_integrity(0); */ /* Can't call it here because of locks */ bins_dump(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ac5eb5cd3f4..71f143c286c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -92,8 +92,9 @@ THD::THD():user_time(0), is_fatal_error(0), { host=user=priv_user=db=query=ip=0; host_or_ip= "connecting host"; - locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password= + locked=count_cuted_fields=some_tables_deleted=no_errors=password= query_start_used=prepare_command=0; + killed= NOT_KILLED; db_length=query_length=col_access=0; query_error= tmp_table_used= 0; next_insert_id=last_insert_id=0; @@ -183,7 +184,7 @@ THD::THD():user_time(0), is_fatal_error(0), if (open_cached_file(&transaction.trans_log, mysql_tmpdir, LOG_PREFIX, binlog_cache_size, MYF(MY_WME))) - killed=1; + killed= KILL_CONNECTION; transaction.trans_log.end_of_file= max_binlog_cache_size; } #endif @@ -347,14 +348,14 @@ THD::~THD() } -void THD::awake(bool prepare_to_die) +void THD::awake(THD::killed_state state_to_set) { THD_CHECK_SENTRY(this); safe_mutex_assert_owner(&LOCK_delete); - if (prepare_to_die) - killed = 1; - thr_alarm_kill(real_id); + killed= state_to_set; + if (state_to_set != THD::KILL_QUERY) + thr_alarm_kill(real_id); #ifdef SIGNAL_WITH_VIO_CLOSE close_active_vio(); #endif @@ -471,7 +472,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length) { my_error(EE_OUTOFMEMORY, MYF(ME_BELL), ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1); - killed= 1; + killed= KILL_CONNECTION; return 0; } diff --git a/sql/sql_class.h b/sql/sql_class.h index d28e89e4416..5cc5d3fe479 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -528,7 +528,18 @@ public: bool query_start_used,last_insert_id_used,insert_id_used,rand_used; bool system_thread,in_lock_tables,global_read_lock; bool query_error, bootstrap, cleanup_done; - bool volatile killed; + + 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; sp_rcontext *spcont; // SP runtime context @@ -572,7 +583,7 @@ public: } void close_active_vio(); #endif - void awake(bool prepare_to_die); + void awake(THD::killed_state state_to_set); inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg) { diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index e13e51e0171..4fac5ddee73 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -211,7 +211,7 @@ cleanup: delete select; free_underlaid_joins(thd, &thd->lex.select_lex); if (error >= 0 || thd->net.report_error) - send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0); + send_error(thd,thd->killed_errno()); else { send_ok(thd,deleted); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2a747bbc089..ab91c3fb29b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -937,7 +937,7 @@ void kill_delayed_threads(void) { /* Ensure that the thread doesn't kill itself while we are looking at it */ pthread_mutex_lock(&tmp->mutex); - tmp->thd.killed=1; + tmp->thd.killed= THD::KILL_CONNECTION; if (tmp->thd.mysys_var) { pthread_mutex_lock(&tmp->thd.mysys_var->mutex); @@ -976,7 +976,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) thd->thread_id=thread_id++; thd->end_time(); threads.append(thd); - thd->killed=abort_loop; + thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED; pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_lock(&di->mutex); @@ -1029,7 +1029,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) for (;;) { - if (thd->killed) + if (thd->killed == THD::KILL_CONNECTION) { uint lock_count; /* @@ -1077,7 +1077,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) break; if (error == ETIME || error == ETIMEDOUT) { - thd->killed=1; + thd->killed= THD::KILL_CONNECTION; break; } } @@ -1096,7 +1096,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) /* request for new delayed insert */ if (!(thd->lock=mysql_lock_tables(thd,&di->table,1))) { - di->dead=thd->killed=1; // Fatal error + di->dead=thd->killed= THD::KILL_CONNECTION; // Fatal error } pthread_cond_broadcast(&di->cond_client); } @@ -1104,7 +1104,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) { if (di->handle_inserts()) { - di->dead=thd->killed=1; // Some fatal error + di->dead=thd->killed=THD::KILL_CONNECTION; // Some fatal error } } di->status=0; @@ -1131,7 +1131,7 @@ end: close_thread_tables(thd); // Free the table di->table=0; - di->dead=thd->killed=1; // If error + di->dead=thd->killed= THD::KILL_CONNECTION; // If error pthread_cond_broadcast(&di->cond_client); // Safety pthread_mutex_unlock(&di->mutex); @@ -1200,7 +1200,7 @@ bool delayed_insert::handle_inserts(void) max_rows=delayed_insert_limit; if (thd.killed || table->version != refresh_version) { - thd.killed=1; + thd.killed= THD::KILL_CONNECTION; max_rows= ~0; // Do as much as possible } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index b46973f91f2..f030fe5e001 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -376,7 +376,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, { if (thd->killed) { - my_error(ER_SERVER_SHUTDOWN,MYF(0)); + thd->send_kill_message(); DBUG_RETURN(1); } it.rewind(); @@ -450,7 +450,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, { if (thd->killed) { - my_error(ER_SERVER_SHUTDOWN,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 cad497f56e3..f3154277d94 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -845,7 +845,7 @@ pthread_handler_decl(handle_one_connection,arg) thd->version=refresh_version; thd->set_time(); thd->init_for_queries(); - while (!net->error && net->vio != 0 && !thd->killed) + while (!net->error && net->vio != 0 && !(thd->killed == THD::KILL_CONNECTION)) { if (do_command(thd)) break; @@ -1049,6 +1049,9 @@ bool do_command(THD *thd) } else { + if (thd->killed == THD::KILL_QUERY) + thd->killed= THD::NOT_KILLED; + packet=(char*) net->read_pos; command = (enum enum_server_command) (uchar) packet[0]; if (command >= COM_END) @@ -1468,7 +1471,7 @@ restore_user: { statistic_increment(com_stat[SQLCOM_KILL],&LOCK_status); ulong id=(ulong) uint4korr(packet); - kill_one_thread(thd,id); + kill_one_thread(thd,id,false); break; } case COM_DEBUG: @@ -1658,7 +1661,7 @@ mysql_execute_command(THD *thd) cursor))) { if (res < 0 || thd->net.report_error) - send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); + send_error(thd,thd->killed_errno()); DBUG_RETURN(res); } } @@ -2921,7 +2924,7 @@ mysql_execute_command(THD *thd) reload_acl_and_cache(thd, lex->type, tables); break; case SQLCOM_KILL: - kill_one_thread(thd,lex->thread_id); + kill_one_thread(thd,lex->thread_id, lex->type & ONLY_KILL_QUERY); break; case SQLCOM_SHOW_GRANTS: res=0; @@ -3157,7 +3160,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 ? ER_SERVER_SHUTDOWN : 0); + send_error(thd,thd->killed_errno()); DBUG_RETURN(res); error: @@ -4239,7 +4242,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) This is written such that we have a short lock on LOCK_thread_count */ -void kill_one_thread(THD *thd, ulong id) +void kill_one_thread(THD *thd, ulong id, bool only_kill_query) { THD *tmp; uint error=ER_NO_SUCH_THREAD; @@ -4259,7 +4262,7 @@ void kill_one_thread(THD *thd, ulong id) if ((thd->master_access & SUPER_ACL) || !strcmp(thd->user,tmp->user)) { - tmp->awake(1 /*prepare to die*/); + tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION); error=0; } else diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index eea0d853132..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 ? ER_SERVER_SHUTDOWN : 0); + send_error(thd,thd->killed_errno()); DBUG_RETURN(1); } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 7e9b6aea7b5..efadaa3d2ca 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -832,7 +832,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) it will be slow because it will iterate through the list again. We just to do kill the thread ourselves. */ - tmp->awake(1/*prepare to die*/); + tmp->awake(THD::KILL_QUERY); pthread_mutex_unlock(&tmp->LOCK_delete); } } diff --git a/sql/sql_repl.h b/sql/sql_repl.h index e3d600b9798..cf5d2387ca5 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -20,7 +20,7 @@ extern I_List<i_string> binlog_do_db, binlog_ignore_db; extern int max_binlog_dump_events; extern my_bool opt_sporadic_binlog_dump_fail; -#define KICK_SLAVE(thd) { pthread_mutex_lock(&(thd)->LOCK_delete); (thd)->awake(0 /* do not prepare to die*/); pthread_mutex_unlock(&(thd)->LOCK_delete); } +#define KICK_SLAVE(thd) { pthread_mutex_lock(&(thd)->LOCK_delete); (thd)->awake(THD::NOT_KILLED); pthread_mutex_unlock(&(thd)->LOCK_delete); } File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b79a2dbad34..61d86c85972 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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,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(ER_SERVER_SHUTDOWN,MYF(0)); + thd->send_kill_message(); error=0; goto err; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8d6eccae87a..b70a42af350 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1343,7 +1343,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) thd_info->command=(int) tmp->command; if ((mysys_var= tmp->mysys_var)) pthread_mutex_lock(&mysys_var->mutex); - thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0); + thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0); #ifndef EMBEDDED_LIBRARY thd_info->state_info= (char*) (tmp->locked ? "Locked" : tmp->net.reading_or_writing ? diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8cf049df5e5..1467baf939c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2370,7 +2370,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, { if (thd->killed) { - my_error(ER_SERVER_SHUTDOWN,MYF(0)); + thd->send_kill_message(); error= 1; break; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b96ddded8d1..b7adbb78316 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -356,7 +356,7 @@ int mysql_update(THD *thd, delete select; free_underlaid_joins(thd, &thd->lex.select_lex); if (error >= 0) - send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); /* purecov: inspected */ + send_error(thd,thd->killed_errno()); /* purecov: inspected */ else { char buff[80]; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0c12895cf2f..598bd24eaf3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -202,6 +202,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token COLUMNS %token COLUMN_SYM %token CONCURRENT +%token CONNECTION_SYM %token CONSTRAINT %token CONVERT_SYM %token DATABASES @@ -4394,18 +4395,23 @@ purge_option: /* kill threads */ kill: - KILL_SYM expr + KILL_SYM kill_option expr { LEX *lex=Lex; - if ($2->fix_fields(lex->thd, 0, &$2) || $2->check_cols(1)) + if ($3->fix_fields(lex->thd, 0, &$3) || $3->check_cols(1)) { send_error(lex->thd, ER_SET_CONSTANTS_ONLY); YYABORT; } lex->sql_command=SQLCOM_KILL; - lex->thread_id= (ulong) $2->val_int(); + lex->thread_id= (ulong) $3->val_int(); }; +kill_option: + /* empty */ { Lex->type= 0; } + | CONNECTION_SYM { Lex->type= 0; } + | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; }; + /* change database */ use: USE_SYM ident |