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.
This commit is contained in:
Sergey Vojtovich 2015-08-11 11:18:38 +04:00
commit 31e365efae
71 changed files with 2720 additions and 2470 deletions

View file

@ -99,20 +99,20 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
nrc.init();
nrc.resolve_in_table_list_only(tables);
res= new Item_cond_or();
res= new Item_cond_or(thd);
if (!res)
return OOM;
for (; filter->str; filter++)
{
Item_field *fld= new Item_field(thd, &nrc, db, table, field);
Item_string *pattern= new Item_string(filter->str, filter->length, cs);
Item_string *escape= new Item_string("\\", 1, cs);
Item_string *pattern= new Item_string(thd, filter->str, filter->length, cs);
Item_string *escape= new Item_string(thd, "\\", 1, cs);
if (!fld || !pattern || !escape)
return OOM;
Item_func_like *like= new Item_func_like(fld, pattern, escape, 0);
Item_func_like *like= new Item_func_like(thd, fld, pattern, escape, 0);
if (!like)
return OOM;

View file

@ -106,10 +106,10 @@ struct tablevec_entry {
struct expr_user_lock : private noncopyable {
expr_user_lock(THD *thd, int timeout)
: lck_key("handlersocket_wr", 16, &my_charset_latin1),
lck_timeout(timeout),
lck_func_get_lock(&lck_key, &lck_timeout),
lck_func_release_lock(&lck_key)
: lck_key(thd, "handlersocket_wr", 16, &my_charset_latin1),
lck_timeout(thd, timeout),
lck_func_get_lock(thd, &lck_key, &lck_timeout),
lck_func_release_lock(thd, &lck_key)
{
lck_key.fix_fields(thd, 0);
lck_timeout.fix_fields(thd, 0);