1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work

with memory roots in THD/Statement/Item_arena.
Added assertions preventing memory allocation on bzero'ed MEM_ROOT since it is worked by 
pure luck and was very ineffective.
This commit is contained in:
dlenev@brandersnatch.localdomain
2004-09-23 13:48:17 +04:00
parent c12c9af224
commit f5d1b711c6
5 changed files with 102 additions and 35 deletions

View File

@ -2554,7 +2554,8 @@ static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
{
QUICK_SELECT *quick=new QUICK_SELECT(thd, table, ref->key, 1);
MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
QUICK_SELECT *quick= new QUICK_SELECT(thd, table, ref->key);
KEY *key_info = &table->key_info[ref->key];
KEY_PART *key_part;
QUICK_RANGE *range;
@ -2566,7 +2567,7 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
{
if (thd->is_fatal_error)
goto err; // out of memory
return quick; // empty range
goto ok; // empty range
}
if (!(range= new QUICK_RANGE()))
@ -2613,9 +2614,12 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
goto err;
}
ok:
my_pthread_setspecific_ptr(THR_MALLOC, old_root);
return quick;
err:
my_pthread_setspecific_ptr(THR_MALLOC, old_root);
delete quick;
return 0;
}