1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Removed TABLE->sort to make it possible to have multiple active calls to

filesort and init_read_record() for the same table.
This will simplify code for WINDOW FUNCTIONS (MDEV-6115)

- Filesort_info renamed to SORT_INFO and moved to filesort.h
- filesort now returns SORT_INFO
- init_read_record() now takes a SORT_INFO parameter.
- unique declaration is moved to uniques.h
- subselect caching of buffers is now more explicit than before
- filesort_buffer is now reusable even if rec_length has changed.
- filsort_free_buffers() and free_io_cache() calls are removed
- Remove one malloc() when using get_addon_fields()

Other things:
- Added --debug-assert-on-not-freed-memory option to make it easier to
  debug some not-freed-memory issues.
This commit is contained in:
Monty
2016-03-22 21:51:59 +02:00
parent d0a47704c5
commit 260dd476b0
40 changed files with 665 additions and 584 deletions

View File

@ -194,7 +194,8 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields,
DBUG_ENTER("search_topics");
/* Should never happen. As this is part of help, we can ignore this */
if (init_read_record(&read_record_info, thd, topics, select, 1, 0, FALSE))
if (init_read_record(&read_record_info, thd, topics, select, NULL, 1, 0,
FALSE))
DBUG_RETURN(0);
while (!read_record_info.read_record(&read_record_info))
@ -229,14 +230,16 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields,
2 found more then one topic matching the mask
*/
int search_keyword(THD *thd, TABLE *keywords, struct st_find_field *find_fields,
int search_keyword(THD *thd, TABLE *keywords,
struct st_find_field *find_fields,
SQL_SELECT *select, int *key_id)
{
int count= 0;
READ_RECORD read_record_info;
DBUG_ENTER("search_keyword");
/* Should never happen. As this is part of help, we can ignore this */
if (init_read_record(&read_record_info, thd, keywords, select, 1, 0, FALSE))
if (init_read_record(&read_record_info, thd, keywords, select, NULL, 1, 0,
FALSE))
DBUG_RETURN(0);
while (!read_record_info.read_record(&read_record_info) && count<2)
@ -370,7 +373,8 @@ int search_categories(THD *thd, TABLE *categories,
DBUG_ENTER("search_categories");
/* Should never happen. As this is part of help, we can ignore this */
if (init_read_record(&read_record_info, thd, categories, select,1,0,FALSE))
if (init_read_record(&read_record_info, thd, categories, select, NULL,
1, 0, FALSE))
DBUG_RETURN(0);
while (!read_record_info.read_record(&read_record_info))
{
@ -406,7 +410,8 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
DBUG_ENTER("get_all_items_for_category");
/* Should never happen. As this is part of help, we can ignore this */
if (init_read_record(&read_record_info, thd, items, select,1,0,FALSE))
if (init_read_record(&read_record_info, thd, items, select, NULL, 1, 0,
FALSE))
DBUG_VOID_RETURN;
while (!read_record_info.read_record(&read_record_info))
@ -608,7 +613,7 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond,
/* Assume that no indexes cover all required fields */
table->covering_keys.clear_all();
SQL_SELECT *res= make_select(table, 0, 0, cond, 0, error);
SQL_SELECT *res= make_select(table, 0, 0, cond, 0, 0, error);
if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
(res && res->quick && res->quick->reset()))
{