mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into genie.(none):/home/hf/work/mysql-5.0.kil
This commit is contained in:
commit
21f1b11fa8
55 changed files with 110 additions and 69 deletions
|
@ -118,6 +118,8 @@ enum enum_server_command
|
|||
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
|
||||
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
|
||||
|
||||
#define ONLY_KILL_QUERY 1
|
||||
|
||||
struct st_vio; /* Only C */
|
||||
typedef struct st_vio Vio;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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,...));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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")));
|
||||
|
@ -691,15 +691,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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,...)
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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((int)thd_arg->killed ? (int)thd_arg->killed : thd_arg->net.last_errno),
|
||||
thread_id(thd_arg->thread_id)
|
||||
{
|
||||
time_t end_time;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -2923,7 +2923,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();
|
||||
|
|
|
@ -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
|
||||
|
@ -333,14 +334,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
|
||||
|
@ -457,7 +458,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,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;
|
||||
|
||||
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
|
||||
|
@ -568,7 +571,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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -951,7 +951,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);
|
||||
|
@ -990,7 +990,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);
|
||||
|
@ -1043,7 +1043,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (thd->killed)
|
||||
if (thd->killed == THD::KILL_CONNECTION)
|
||||
{
|
||||
uint lock_count;
|
||||
/*
|
||||
|
@ -1091,7 +1091,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;
|
||||
}
|
||||
}
|
||||
|
@ -1110,7 +1110,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);
|
||||
}
|
||||
|
@ -1118,7 +1118,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;
|
||||
|
@ -1145,7 +1145,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);
|
||||
|
||||
|
@ -1214,7 +1214,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
|
||||
}
|
||||
|
||||
|
|
|
@ -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++))
|
||||
|
|
|
@ -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:
|
||||
|
@ -1655,7 +1658,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);
|
||||
}
|
||||
}
|
||||
|
@ -2908,7 +2911,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;
|
||||
|
@ -3138,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 ? ER_SERVER_SHUTDOWN : 0);
|
||||
send_error(thd,thd->killed);
|
||||
DBUG_RETURN(res);
|
||||
|
||||
error:
|
||||
|
@ -4213,7 +4216,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;
|
||||
|
@ -4233,7 +4236,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
|
||||
|
|
|
@ -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);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
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)
|
||||
|
@ -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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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 */
|
||||
my_error(join->thd->killed,MYF(0)); /* purecov: inspected */
|
||||
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));
|
||||
my_error(thd->killed,MYF(0));
|
||||
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));
|
||||
my_error(thd->killed,MYF(0));
|
||||
error=0;
|
||||
goto err;
|
||||
}
|
||||
|
|
|
@ -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 ?
|
||||
|
|
|
@ -2381,7 +2381,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;
|
||||
}
|
||||
|
|
|
@ -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 ? ER_SERVER_SHUTDOWN : 0); /* purecov: inspected */
|
||||
send_error(thd,thd->killed); /* purecov: inspected */
|
||||
else
|
||||
{
|
||||
char buff[80];
|
||||
|
|
|
@ -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
|
||||
|
@ -4362,18 +4363,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
|
||||
|
|
Loading…
Reference in a new issue