diff options
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c9311cdf398..37cc0b1ee7b 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 @@ -11146,9 +11148,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++) { @@ -11174,8 +11176,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); } @@ -11183,18 +11184,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)); |