summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <hf@genie.(none)>2003-03-31 13:39:46 +0500
committerunknown <hf@genie.(none)>2003-03-31 13:39:46 +0500
commit3814f2a8edf71a964cdbd8c965790d7216eff9fa (patch)
treef4464e6b282d974ae15bcac10865fa2b4d457ae4
parent02a37fb8a7032ec9f56aa8a152e7a6c4f10f50c2 (diff)
downloadmariadb-git-3814f2a8edf71a964cdbd8c965790d7216eff9fa.tar.gz
SCRUM
two KILL commands implementation (version 2) include/mysqld_error.h: Error message about query interruption added myisam/mi_check.c: killed_ptr now retutns only value - not pointer myisam/myisamchk.c: killed_ptr returns value now myisam/myisamdef.h: killed_ptr returns value now myisam/sort.c: killed_ptr returns value now sql/filesort.cc: THD::killed now has enum type sql/ha_berkeley.cc: THD::killed has enum type sql/ha_myisam.cc: killed_ptr returns value now sql/lock.cc: two different errors possible here now sql/log_event.cc: two ways of killing possible here now sql/mysqld.cc: THD::killed has enum type now sql/records.cc: two errors are possible here now sql/share/czech/errmsg.txt: new error message sql/share/danish/errmsg.txt: new error message sql/share/dutch/errmsg.txt: new error message sql/share/english/errmsg.txt: new error message sql/share/estonian/errmsg.txt: new error message sql/share/french/errmsg.txt: new error message sql/share/german/errmsg.txt: new error message sql/share/greek/errmsg.txt: new error message sql/share/hungarian/errmsg.txt: new error message sql/share/italian/errmsg.txt: new error message sql/share/japanese/errmsg.txt: new error message sql/share/korean/errmsg.txt: new error message sql/share/norwegian-ny/errmsg.txt: new error message sql/share/norwegian/errmsg.txt: new error message sql/share/polish/errmsg.txt: new error message sql/share/portuguese/errmsg.txt: new error message sql/share/romanian/errmsg.txt: new error message sql/share/russian/errmsg.txt: new error message sql/share/serbian/errmsg.txt: new error message sql/share/slovak/errmsg.txt: new error message sql/share/spanish/errmsg.txt: new error message sql/share/swedish/errmsg.txt: new error message sql/share/ukrainian/errmsg.txt: new error message sql/slave.cc: two errors are possible here now sql/sql_base.cc: THD::killed has enum type now sql/sql_cache.cc: THD::killed has enum type now sql/sql_class.cc: THD::awake implementation changed to handle KILL_QUERY sql/sql_class.h: class THD changed to handle KILL_QUERY sql/sql_delete.cc: two errors are possible here now sql/sql_insert.cc: THD::killed has enum type now sql/sql_load.cc: two errors are possible here now sql/sql_parse.cc: kill_one_thread function changed to handle KILL_QUERY sql/sql_prepare.cc: two errors are possible here now sql/sql_repl.cc: the parameter to awake is of THD::killed_state type now sql/sql_repl.h: awake parameter changed sql/sql_select.cc: two errors are possible here now sql/sql_show.cc: notification adopted to changes in class THD sql/sql_table.cc: two errors are possible here now sql/sql_update.cc: two errors are possible here now
-rw-r--r--include/mysqld_error.h3
-rw-r--r--myisam/mi_check.c2
-rw-r--r--myisam/myisamchk.c4
-rw-r--r--myisam/myisamdef.h2
-rw-r--r--myisam/sort.c5
-rw-r--r--sql/filesort.cc8
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/ha_myisam.cc4
-rw-r--r--sql/lock.cc2
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/records.cc2
-rw-r--r--sql/share/czech/errmsg.txt1
-rw-r--r--sql/share/danish/errmsg.txt1
-rw-r--r--sql/share/dutch/errmsg.txt1
-rw-r--r--sql/share/english/errmsg.txt1
-rw-r--r--sql/share/estonian/errmsg.txt1
-rw-r--r--sql/share/french/errmsg.txt1
-rw-r--r--sql/share/german/errmsg.txt1
-rw-r--r--sql/share/greek/errmsg.txt1
-rw-r--r--sql/share/hungarian/errmsg.txt1
-rw-r--r--sql/share/italian/errmsg.txt1
-rw-r--r--sql/share/japanese/errmsg.txt1
-rw-r--r--sql/share/korean/errmsg.txt1
-rw-r--r--sql/share/norwegian-ny/errmsg.txt1
-rw-r--r--sql/share/norwegian/errmsg.txt1
-rw-r--r--sql/share/polish/errmsg.txt1
-rw-r--r--sql/share/portuguese/errmsg.txt1
-rw-r--r--sql/share/romanian/errmsg.txt1
-rw-r--r--sql/share/russian/errmsg.txt1
-rw-r--r--sql/share/serbian/errmsg.txt1
-rw-r--r--sql/share/slovak/errmsg.txt1
-rw-r--r--sql/share/spanish/errmsg.txt1
-rw-r--r--sql/share/swedish/errmsg.txt1
-rw-r--r--sql/share/ukrainian/errmsg.txt1
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_cache.cc2
-rw-r--r--sql/sql_class.cc15
-rw-r--r--sql/sql_class.h8
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_insert.cc16
-rw-r--r--sql/sql_load.cc4
-rw-r--r--sql/sql_parse.cc21
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_repl.h2
-rw-r--r--sql/sql_select.cc18
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_update.cc2
51 files changed, 93 insertions, 74 deletions
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index 70e9a70ea9d..056de3f29c7 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -282,4 +282,5 @@
#define ER_SP_BADSELECT 1263
#define ER_SP_BADRETURN 1264
#define ER_SP_BADQUERY 1265
-#define ER_ERROR_MESSAGES 266
+#define ER_QUERY_INTERRUPTED 1266
+#define ER_ERROR_MESSAGES 267
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index d0e9d17a43b..7ae61bb7275 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))
+ if (killed_ptr(param->thd))
DBUG_RETURN(1);
switch (share->data_file_type) {
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 104b344a9e2..d816cd3f2a2 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -1644,9 +1644,9 @@ err:
DBUG_RETURN(1);
} /* sort_record_index */
-volatile bool *killed_ptr(MI_CHECK *param)
+bool killed_ptr(void *thd)
{
- return (bool *)(& param->thd); /* always NULL */
+ return (bool)thd; /* always NULL */
}
/* print warnings and errors */
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 25f2969a973..b2d6807ad73 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 */
-volatile bool *killed_ptr(MI_CHECK *param);
+bool 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 006b96cfaab..1913af650c0 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -844,7 +844,8 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile bool *killed= killed_ptr(info->sort_info->param);
+ void *thd= info->sort_info->param->thd;
+
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -875,7 +876,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{
for (;;)
{
- if (*killed)
+ if (killed_ptr(thd))
{
error=1; goto err;
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index cc7b15f1f4a..7e4e9687860 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -277,7 +277,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= &current_thd->killed;
+ volatile THD::killed_state *killed= &current_thd->killed;
handler *file;
DBUG_ENTER("find_all_keys");
DBUG_PRINT("info",("using: %s",(select?select->quick?"ranges":"where":"every row")));
@@ -690,15 +690,15 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
BUFFPEK *buffpek,**refpek;
QUEUE queue;
qsort2_cmp cmp;
- volatile bool *killed= &current_thd->killed;
- bool not_killable;
+ volatile THD::killed_state *killed= &current_thd->killed;
+ THD::killed_state not_killable;
DBUG_ENTER("merge_buffers");
statistic_increment(filesort_merge_passes, &LOCK_status);
if (param->not_killable)
{
killed= &not_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 26268f5deaf..7b3e3f6b942 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)
+bool killed_ptr(void *thd)
{
- return &(((THD *)(param->thd))->killed);
+ return ((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 8f342b28d67..d2ad47cbbfa 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));
+ my_error(thd->killed, MYF(0));
if (sql_lock)
{
mysql_unlock_tables(thd,sql_lock);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 3a1dbb6485e..7cb7310cfdd 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -770,7 +770,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((int)thd_arg->killed ? (int)thd_arg->killed : thd_arg->net.last_errno),
thread_id(thd_arg->thread_id)
{
time_t end_time;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7f9c39e7e8f..16187fd044b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -632,7 +632,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;
@@ -1393,7 +1393,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
@@ -2802,7 +2802,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..38904fa405f 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));
+ my_error(info->thd->killed,MYF(0));
return 1;
}
if (tmp != HA_ERR_RECORD_DELETED)
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 4d93ecf7db3..50fe3a70436 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -276,3 +276,4 @@ v/*
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index c5cf27a94d7..beed74938a2 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -270,3 +270,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 6105d619ec0..e7d895426a8 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -278,3 +278,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index bcd96916516..7e6adec8374 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 6f90684dcfe..ff545578756 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -272,3 +272,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 56065154b38..cb3de886601 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index b1b6e695fb1..1c959902678 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -277,3 +277,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index bad888430ef..65df4417f3f 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 1ee7d95bebe..f14f27728e9 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -269,3 +269,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index dcacb064356..d9eff4aa546 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index bb928217a6d..158092ef605 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -269,3 +269,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 0f6f4f95fa9..5b9e18c2113 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 4ece1312243..b14d8f5bbca 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -269,3 +269,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 9b2165909aa..40cfe267908 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -269,3 +269,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 2d988a62860..9e4e82640e5 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -271,3 +271,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 24cc385b1ed..04b643de0ba 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 4ab6c04d67b..fc9510022b9 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -271,3 +271,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index befadcf02df..3c6d81667b2 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -270,3 +270,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 402f4b94f70..d0fdcfd1fff 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -263,3 +263,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 5e0cf29c734..1fc8bc65b37 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -275,3 +275,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index e26ca91bd8d..cea2db1f19d 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -268,3 +268,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index e7142c65066..00327211a5b 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -267,3 +267,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 242c1bef664..d3e19d5761c 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -272,3 +272,4 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
+"Query execution was interrupted"
diff --git a/sql/slave.cc b/sql/slave.cc
index b06895b1779..787201841f7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -543,7 +543,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);
}
}
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 79f0e7eb269..8ef85f77008 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2390,7 +2390,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 90fd61ebeb7..cbd6e008586 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 cf790012c37..7058b9d7b3c 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -85,8 +85,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;
@@ -176,7 +177,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
@@ -318,14 +319,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
@@ -442,7 +443,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 f1817876fc3..1e293fd0323 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -548,8 +548,10 @@ 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;
- bool volatile only_kill_query;
+
+ enum killed_state { NOT_KILLED=0, KILL_CONNECTION=ER_SERVER_SHUTDOWN, KILL_QUERY=ER_QUERY_INTERRUPTED };
+ killed_state volatile killed;
+
bool prepare_command;
bool tmp_table_used;
sp_rcontext *spcont; // SP runtime context
@@ -592,7 +594,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 05f84616a4c..921854469a5 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 ? ER_SERVER_SHUTDOWN: 0);
+ send_error(thd,thd->killed);
else
{
send_ok(thd,deleted);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 9ca51ebc053..aee545b5bbb 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -935,7 +935,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);
@@ -974,7 +974,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);
@@ -1027,7 +1027,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
for (;;)
{
- if (thd->killed)
+ if (thd->killed == THD::KILL_CONNECTION)
{
uint lock_count;
/*
@@ -1075,7 +1075,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;
}
}
@@ -1094,7 +1094,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);
}
@@ -1102,7 +1102,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;
@@ -1129,7 +1129,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);
@@ -1198,7 +1198,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 4f5b19e6f49..69585ddbc77 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(ER_SERVER_SHUTDOWN,MYF(0));
+ my_error(thd->killed,MYF(0));
DBUG_RETURN(1);
}
it.rewind();
@@ -453,7 +453,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
{
if (thd->killed)
{
- my_error(ER_SERVER_SHUTDOWN,MYF(0));
+ my_error(thd->killed,MYF(0));
DBUG_RETURN(1);
}
while ((sql_field=(Item_field*) it++))
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 278b7b92574..d99a3d4bbea 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -848,7 +848,7 @@ pthread_handler_decl(handle_one_connection,arg)
init_sql_alloc(&thd->mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
init_sql_alloc(&thd->transaction.mem_root,
TRANS_MEM_ROOT_BLOCK_SIZE, TRANS_MEM_ROOT_PREALLOC);
- while (!net->error && net->vio != 0 && !(thd->killed && !thd->only_kill_query))
+ while (!net->error && net->vio != 0 && !(thd->killed == THD::KILL_CONNECTION))
{
if (do_command(thd))
break;
@@ -1054,11 +1054,8 @@ bool do_command(THD *thd)
}
else
{
- if (thd->only_kill_query)
- {
- thd->killed= FALSE;
- thd->only_kill_query= FALSE;
- }
+ if (thd->killed == THD::KILL_QUERY)
+ thd->killed= THD::NOT_KILLED;
packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0];
@@ -1666,7 +1663,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);
DBUG_RETURN(res);
}
}
@@ -3126,7 +3123,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);
DBUG_RETURN(res);
error:
@@ -4221,13 +4218,7 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
if ((thd->master_access & SUPER_ACL) ||
!strcmp(thd->user,tmp->user))
{
- if (only_kill_query)
- {
- tmp->killed= 1;
- tmp->only_kill_query= 1;
- }
- else
- 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 fc8959c6493..cc762f28fd8 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -675,7 +675,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);
DBUG_RETURN(1);
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index fd6c9060079..12d110ac35b 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -826,7 +826,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 0192d9f7ab2..ad2a66da573 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4943,7 +4943,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
return -2; /* purecov: inspected */
}
if (join_tab->use_quick != 2 || test_if_quick_select(join_tab) <= 0)
@@ -4982,7 +4982,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
return -2; /* purecov: inspected */
}
join->examined_rows++;
@@ -5062,7 +5062,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
return -2; // Aborted by user /* purecov: inspected */
}
SQL_SELECT *select=join_tab->select;
@@ -5710,7 +5710,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-2); /* purecov: inspected */
}
if (!end_of_records)
@@ -5778,7 +5778,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-2); /* purecov: inspected */
}
@@ -5848,7 +5848,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-2); /* purecov: inspected */
}
@@ -5895,7 +5895,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 */
+ my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-2); /* purecov: inspected */
}
if (!join->first_record || end_of_records ||
@@ -6617,7 +6617,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
{
if (thd->killed)
{
- my_error(ER_SERVER_SHUTDOWN,MYF(0));
+ my_error(thd->killed,MYF(0));
error=0;
goto err;
}
@@ -6729,7 +6729,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
{
if (thd->killed)
{
- my_error(ER_SERVER_SHUTDOWN,MYF(0));
+ my_error(thd->killed,MYF(0));
error=0;
goto err;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 00df2c44fd6..80749afb533 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1335,7 +1335,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 0033451a439..bba82dd5bbc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2379,7 +2379,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
{
if (thd->killed)
{
- my_error(ER_SERVER_SHUTDOWN,MYF(0));
+ my_error(thd->killed,MYF(0));
error= 1;
break;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 95128b2db3d..95db54944cd 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -355,7 +355,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); /* purecov: inspected */
else
{
char buff[80];