summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-19 02:00:26 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-19 02:00:26 +0200
commit88df4e732605df862dd264f65788ab1d58a9b153 (patch)
treeb0e673f712bc31db28ac10bae4d5f3302fd63710 /sql/log_event.cc
parentb2ba400f07d843903ab6efd946940a6e6e76fc3c (diff)
downloadmariadb-git-88df4e732605df862dd264f65788ab1d58a9b153.tar.gz
Fixes cases where thd->query was not protected.
This fixes a problem with SHOW PROCESSLIST sql/log_event.cc: Fixes cases where thd->query was not protected sql/sql_acl.cc: Table privileges was not reset on FLUSH PRIVILEGES if tables_priv was empty sql/sql_db.cc: Fixes cases where thd->query was not protected
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 45f54e420de..e243a953c63 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1702,10 +1702,11 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
- thd->query = (char*)query;
thd->set_time((time_t)when);
thd->current_tablenr = 0;
+ thd->query_length= q_len;
VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->query = (char*)query;
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->query_error = 0; // clear error
@@ -1760,7 +1761,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
else
{
// master could be inconsistent, abort and tell DBA to check/fix it
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db = thd->query = 0;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->variables.convert_set = 0;
close_thread_tables(thd);
free_root(&thd->mem_root,0);
@@ -1768,7 +1771,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
}
}
thd->db= 0; // prevent db from being freed
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query= 0; // just to be sure
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
// assume no convert for next query unless set explictly
thd->variables.convert_set = 0;
close_thread_tables(thd);
@@ -1816,7 +1821,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)db);
- thd->query = 0;
+ DBUG_ASSERT(thd->query == 0);
+ thd->query = 0; // Should not be needed
thd->query_error = 0;
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))