summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ae481c3e3db..9f8f17eb4ba 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1245,6 +1245,9 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT()
quick->file= NULL;
quick_selects.delete_elements();
delete pk_quick_select;
+ /* It's ok to call the next two even if they are already deinitialized */
+ end_read_record(&read_record);
+ free_io_cache(head);
free_root(&alloc,MYF(0));
DBUG_VOID_RETURN;
}
@@ -2668,7 +2671,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
PART_PRUNE_PARAM prune_param;
MEM_ROOT alloc;
RANGE_OPT_PARAM *range_par= &prune_param.range_param;
- my_bitmap_map *old_read_set, *old_write_set;
+ my_bitmap_map *old_sets[2];
prune_param.part_info= part_info;
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
@@ -2682,8 +2685,8 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
DBUG_RETURN(FALSE);
}
- old_write_set= dbug_tmp_use_all_columns(table, table->write_set);
- old_read_set= dbug_tmp_use_all_columns(table, table->read_set);
+ dbug_tmp_use_all_columns(table, old_sets,
+ table->read_set, table->write_set);
range_par->thd= thd;
range_par->table= table;
/* range_par->cond doesn't need initialization */
@@ -2773,8 +2776,7 @@ all_used:
retval= FALSE; // some partitions are used
mark_all_partitions_as_used(prune_param.part_info);
end:
- dbug_tmp_restore_column_map(table->write_set, old_write_set);
- dbug_tmp_restore_column_map(table->read_set, old_read_set);
+ dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
thd->no_errors=0;
thd->mem_root= range_par->old_root;
free_root(&alloc,MYF(0)); // Return memory & allocator
@@ -11145,9 +11147,9 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
String tmp(buff,sizeof(buff),&my_charset_bin);
uint store_length;
TABLE *table= key_part->field->table;
- my_bitmap_map *old_write_set, *old_read_set;
- old_write_set= dbug_tmp_use_all_columns(table, table->write_set);
- old_read_set= dbug_tmp_use_all_columns(table, table->read_set);
+ my_bitmap_map *old_sets[2];
+
+ dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set);
for (; key < key_end; key+=store_length, key_part++)
{
@@ -11173,8 +11175,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
if (key+store_length < key_end)
fputc('/',DBUG_FILE);
}
- dbug_tmp_restore_column_map(table->write_set, old_write_set);
- dbug_tmp_restore_column_map(table->read_set, old_read_set);
+ dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
}
@@ -11182,18 +11183,16 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
{
char buf[MAX_KEY/8+1];
TABLE *table;
- my_bitmap_map *old_read_map, *old_write_map;
+ my_bitmap_map *old_sets[2];
DBUG_ENTER("print_quick");
if (!quick)
DBUG_VOID_RETURN;
DBUG_LOCK_FILE;
table= quick->head;
- old_read_map= dbug_tmp_use_all_columns(table, table->read_set);
- old_write_map= dbug_tmp_use_all_columns(table, table->write_set);
+ dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set);
quick->dbug_dump(0, TRUE);
- dbug_tmp_restore_column_map(table->read_set, old_read_map);
- dbug_tmp_restore_column_map(table->write_set, old_write_map);
+ dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf));