summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-03-01 09:15:33 +0300
committerunknown <dlenev@brandersnatch.localdomain>2004-03-01 09:15:33 +0300
commit23a6b4ed825b2ace2e4a81b6103f324a9300b301 (patch)
tree0b6613dd9fa679527c3022e35628c1f6717a35ca /sql/sp_head.cc
parent9ce4695da0bfe74e840dcf708da10cac9740e137 (diff)
downloadmariadb-git-23a6b4ed825b2ace2e4a81b6103f324a9300b301.tar.gz
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
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index a68118cecd1..bfd7ad259f6 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -796,7 +796,10 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
thd->lex->unit.thd= thd; // QQ Not reentrant
freelist= thd->free_list;
thd->free_list= NULL;
+
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
// Copy WHERE clause pointers to avoid damaging by optimisation
// Also clear ref_pointer_arrays.