[Commits] 97d212a: MDEV-10545: Server crashed in my_copy_fix_mb on querying I_S and P_S tables

Nirbhay Choubey nirbhay at mariadb.com
Thu Sep 1 19:46:58 EEST 2016


revision-id: 97d212a34ff4e0558126bc393bbef97036611d83 (mariadb-10.1.17-4-g97d212a)
parent(s): a322651b8aa702e58d473edfae26606f10a089fb
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-09-01 12:46:56 -0400
message:

MDEV-10545: Server crashed in my_copy_fix_mb on querying I_S and P_S tables

Once THDs have been added to the global "threads" list,
they must modify query_string only after acquiring per-
thread LOCK_thd_data mutex.

---
 sql/log_event.cc | 2 +-
 sql/sql_acl.cc   | 8 ++++----
 sql/sql_parse.cc | 7 +++----
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/sql/log_event.cc b/sql/log_event.cc
index afa58af..66e7c60 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6022,7 +6022,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
   new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
   thd->set_db(new_db.str, new_db.length);
   DBUG_ASSERT(thd->query() == 0);
-  thd->reset_query_inner();                    // Should not be needed
+  if (thd->query()) thd->reset_query();         // Should not be needed
   thd->is_slave_error= 0;
   clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
 
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 23302e1..48c5730 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2797,7 +2797,7 @@ bool change_password(THD *thd, LEX_USER *user)
 
   if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
   {
-    thd->set_query_inner(buff, query_length, system_charset_info);
+    thd->set_query(buff, query_length, system_charset_info);
     WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
   }
 
@@ -2858,7 +2858,7 @@ bool change_password(THD *thd, LEX_USER *user)
   {
     WSREP_TO_ISOLATION_END;
 
-    thd->set_query_inner(query_save);
+    thd->set_query(query_save);
     thd->wsrep_exec_mode  = LOCAL_STATE;
   }
 #endif /* WITH_WSREP */
@@ -2913,7 +2913,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
 
   if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
   {
-    thd->set_query_inner(buff, query_length, system_charset_info);
+    thd->set_query(buff, query_length, system_charset_info);
     WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
   }
 
@@ -3009,7 +3009,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
   {
     WSREP_TO_ISOLATION_END;
 
-    thd->set_query_inner(query_save);
+    thd->set_query(query_save);
     thd->wsrep_exec_mode  = LOCAL_STATE;
   }
 #endif /* WITH_WSREP */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c6d80e1..a15f3da 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7298,10 +7298,9 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
             Note that we don't need LOCK_thread_count to modify query_length.
           */
           if (found_semicolon && (ulong) (found_semicolon - thd->query()))
-            thd->set_query_inner(thd->query(),
-                                 (uint32) (found_semicolon -
-                                           thd->query() - 1),
-                                 thd->charset());
+            thd->set_query(thd->query(),
+                           (uint32) (found_semicolon - thd->query() - 1),
+                           thd->charset());
           /* Actually execute the query */
           if (found_semicolon)
           {


More information about the commits mailing list