diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-11 11:18:38 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-21 10:40:39 +0400 |
commit | 31e365efae28ba3208e80511c4d18fe11a79541a (patch) | |
tree | f249682cc42490fc86382f5244a051001dc13c9e /sql/sql_class.h | |
parent | 4374da63f03abc472f68f42e4e93261a18bfe417 (diff) | |
download | mariadb-git-31e365efae28ba3208e80511c4d18fe11a79541a.tar.gz |
MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor.
Added thd parameter to all routines that may create items.
Also removed "current_thd" from Item::Item. This reduced number of
pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index ae1d6418ffb..23e146c6750 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4088,6 +4088,8 @@ class JOIN; class select_result_sink: public Sql_alloc { public: + THD *thd; + select_result_sink(THD *thd_arg): thd(thd_arg) {} /* send_data returns 0 on ok, 1 on error and -1 if data was ignored, for example for a duplicate row entry written to a temp table. @@ -4112,7 +4114,6 @@ public: class select_result :public select_result_sink { protected: - THD *thd; /* All descendant classes have their send_data() skip the first unit->offset_limit_cnt rows sent. Select_materialize @@ -4121,7 +4122,7 @@ protected: SELECT_LEX_UNIT *unit; /* Something used only by the parser: */ public: - select_result(THD *thd_arg): thd(thd_arg) {} + select_result(THD *thd_arg): select_result_sink(thd_arg) {} virtual ~select_result() {}; /** Change wrapped select_result. @@ -4208,9 +4209,8 @@ class select_result_explain_buffer : public select_result_sink { public: select_result_explain_buffer(THD *thd_arg, TABLE *table_arg) : - thd(thd_arg), dst_table(table_arg) {}; + select_result_sink(thd_arg), dst_table(table_arg) {}; - THD *thd; TABLE *dst_table; /* table to write into */ /* The following is called in the child thread: */ @@ -4227,7 +4227,7 @@ public: class select_result_text_buffer : public select_result_sink { public: - select_result_text_buffer(THD *thd_arg) : thd(thd_arg) {} + select_result_text_buffer(THD *thd_arg): select_result_sink(thd_arg) {} int send_data(List<Item> &items); bool send_result_set_metadata(List<Item> &fields, uint flag); @@ -4235,7 +4235,6 @@ public: private: int append_row(List<Item> &items, bool send_names); - THD *thd; List<char*> rows; int n_columns; }; |