diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-02-19 21:40:15 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-02-19 21:40:15 +0100 |
commit | 11d27996e4472882096bfdb2504061448f689672 (patch) | |
tree | 1e68fac3d9bda4463f2e71df4a6bf0d7f537dc55 /sql | |
parent | afcd7091a075bb2a6032578a4d6414ae4135aeb5 (diff) | |
download | mariadb-git-11d27996e4472882096bfdb2504061448f689672.tar.gz |
increment and get the query_id atomically, otherwise two concurrent threads
might end up having the same query id
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_parse.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 20fba8e49ae..61c822f0d69 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -917,9 +917,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, DEBUG_SYNC(thd,"dispatch_command_before_set_time"); thd->set_time(); - thd->set_query_id(get_query_id()); - if (!(server_command_flags[command] & CF_SKIP_QUERY_ID)) - next_query_id(); + if (server_command_flags[command] & CF_SKIP_QUERY_ID) + thd->set_query_id(get_query_id()); + else + thd->set_query_id(next_query_id()); inc_thread_running(); if (!(server_command_flags[command] & CF_SKIP_QUESTIONS)) |