From 31e365efae28ba3208e80511c4d18fe11a79541a Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 11 Aug 2015 11:18:38 +0400 Subject: 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. --- sql/events.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sql/events.cc') diff --git a/sql/events.cc b/sql/events.cc index d1cbd297809..911a683b723 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -639,29 +639,30 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) if (et->get_create_event(thd, &show_str)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string("Event", NAME_CHAR_LEN)); + field_list.push_back(new Item_empty_string(thd, "Event", NAME_CHAR_LEN)); if (sql_mode_string_representation(thd, et->sql_mode, &sql_mode)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string("sql_mode", (uint) sql_mode.length)); + field_list.push_back(new Item_empty_string(thd, "sql_mode", + (uint) sql_mode.length)); tz_name= et->time_zone->get_name(); - field_list.push_back(new Item_empty_string("time_zone", + field_list.push_back(new Item_empty_string(thd, "time_zone", tz_name->length())); - field_list.push_back(new Item_empty_string("Create Event", + field_list.push_back(new Item_empty_string(thd, "Create Event", show_str.length())); field_list.push_back( - new Item_empty_string("character_set_client", MY_CS_NAME_SIZE)); + new Item_empty_string(thd, "character_set_client", MY_CS_NAME_SIZE)); field_list.push_back( - new Item_empty_string("collation_connection", MY_CS_NAME_SIZE)); + new Item_empty_string(thd, "collation_connection", MY_CS_NAME_SIZE)); field_list.push_back( - new Item_empty_string("Database Collation", MY_CS_NAME_SIZE)); + new Item_empty_string(thd, "Database Collation", MY_CS_NAME_SIZE)); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) -- cgit v1.2.1