[Commits] a0a7566: MDEV-7006: fix of allocation of Query_arena

sanja at mariadb.com sanja at mariadb.com
Tue Mar 10 17:19:01 EET 2015


revision-id: a0a75663bdd0d8b251f7732ffcc7600af39a208f
parent(s): 3f828e632af602b0031ad4c073a2c38c5ad7862d
committer: Oleksandr Byelkin
branch nick: server
timestamp: 2015-03-10 16:18:58 +0100
message:

MDEV-7006: fix of allocation of Query_arena

---
 sql/sql_class.h | 13 +++++++++++++
 sql/sql_lex.cc  |  5 +++--
 sql/sql_lex.h   |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/sql/sql_class.h b/sql/sql_class.h
index e784300..dd5b623 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -920,6 +920,19 @@ class Query_arena
 };
 
 
+class Query_arena_memroot: public Query_arena, public Sql_alloc
+{
+public:
+  Query_arena_memroot(MEM_ROOT *mem_root_arg, enum enum_state state_arg) :
+    Query_arena(mem_root_arg, state_arg)
+  {}
+  Query_arena_memroot() : Query_arena()
+  {}
+
+  virtual ~Query_arena_memroot() {}
+};
+
+
 class Server_side_cursor;
 
 /**
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 1593e2a..f603534 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4246,8 +4246,9 @@ bool LEX::set_arena_for_set_stmt(Query_arena *backup)
     init_sql_alloc(mem_root_for_set_stmt, ALLOC_ROOT_SET, ALLOC_ROOT_SET,
                    MYF(MY_THREAD_SPECIFIC));
   }
-  if (!(arena_for_set_stmt= new Query_arena(mem_root_for_set_stmt,
-                                            Query_arena::STMT_INITIALIZED)))
+  if (!(arena_for_set_stmt= new(mem_root_for_set_stmt)
+        Query_arena_memroot(mem_root_for_set_stmt,
+                            Query_arena::STMT_INITIALIZED)))
     DBUG_RETURN(1);
   DBUG_PRINT("info", ("mem_root: 0x%lx  arena: 0x%lx",
                       (ulong) mem_root_for_set_stmt,
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index bac9044..5522d57 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2369,6 +2369,7 @@ class Delete_plan : public Update_plan
 };
 
 
+class Query_arena_memroot;
 /* The state of the lex parsing. This is saved in the THD struct */
 
 struct LEX: public Query_tables_list
@@ -2433,7 +2434,7 @@ struct LEX: public Query_tables_list
   List<set_var_base>  stmt_var_list; //SET_STATEMENT values
   List<set_var_base>  old_var_list; // SET STATEMENT old values
 private:
-  Query_arena *arena_for_set_stmt;
+  Query_arena_memroot *arena_for_set_stmt;
   MEM_ROOT *mem_root_for_set_stmt;
 public:
   inline bool is_arena_for_set_stmt() {return arena_for_set_stmt != 0;}


More information about the commits mailing list