SCRUM
two KILL commands implementation (version 2)
This commit is contained in:
parent
d00b3ba511
commit
f8f0b70380
@ -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;
|
||||
}
|
||||
|
@ -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= ¤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")));
|
||||
@ -690,15 +690,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,...)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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++))
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 ?
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user