Fixed small race condition, when global query_id was modified
without proper locking. sql/sp_head.cc: Added missing locking of LOCK_thread_count to place where ::query_id is modified. sql/sql_parse.cc: Added comment to the only place where we are modifying ::query_id without following locking protocol, to avoid mistakes in future. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
This commit is contained in:
parent
9ce4695da0
commit
23a6b4ed82
@ -24,6 +24,7 @@ bk@admin.bk
|
|||||||
bk@mysql.r18.ru
|
bk@mysql.r18.ru
|
||||||
carsten@tsort.bitbybit.dk
|
carsten@tsort.bitbybit.dk
|
||||||
davida@isil.mysql.com
|
davida@isil.mysql.com
|
||||||
|
dlenev@brandersnatch.localdomain
|
||||||
dlenev@build.mysql.com
|
dlenev@build.mysql.com
|
||||||
dlenev@mysql.com
|
dlenev@mysql.com
|
||||||
gerberb@ou800.zenez.com
|
gerberb@ou800.zenez.com
|
||||||
|
@ -796,7 +796,10 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
|
|||||||
thd->lex->unit.thd= thd; // QQ Not reentrant
|
thd->lex->unit.thd= thd; // QQ Not reentrant
|
||||||
freelist= thd->free_list;
|
freelist= thd->free_list;
|
||||||
thd->free_list= NULL;
|
thd->free_list= NULL;
|
||||||
|
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||||
thd->query_id= query_id++;
|
thd->query_id= query_id++;
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||||
|
|
||||||
// Copy WHERE clause pointers to avoid damaging by optimisation
|
// Copy WHERE clause pointers to avoid damaging by optimisation
|
||||||
// Also clear ref_pointer_arrays.
|
// Also clear ref_pointer_arrays.
|
||||||
|
@ -1086,6 +1086,10 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
|
|||||||
thd->query_length=length;
|
thd->query_length=length;
|
||||||
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
|
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
|
||||||
thd->query[length] = '\0';
|
thd->query[length] = '\0';
|
||||||
|
/*
|
||||||
|
We don't need to obtain LOCK_thread_count here because in bootstrap
|
||||||
|
mode we have only one thread.
|
||||||
|
*/
|
||||||
thd->query_id=query_id++;
|
thd->query_id=query_id++;
|
||||||
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
|
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user