diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2007-05-22 15:58:30 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2007-05-22 15:58:30 +0300 |
commit | 3332b80130172656c1e483e5bc9aa2bcfe741a8f (patch) | |
tree | 08d9d02d66f614e32a6d645cfda994fa73990360 /sql/table.h | |
parent | b015146e41590e7202c9ab128124b20a3521164c (diff) | |
download | mariadb-git-3332b80130172656c1e483e5bc9aa2bcfe741a8f.tar.gz |
Bug #28476: force index on a disabled myisam index gives error 124
When processing the USE/FORCE index hints
the optimizer was not checking if the indexes
specified are enabled (see ALTER TABLE).
Fixed by:
Backporting the fix for bug 20604 to 5.0
mysql-test/r/key.result:
Test for BUG 20604.
The important part of the test is the explain output that
tests what indexes are used.
mysql-test/r/myisam.result:
Bug #28476: test cases
mysql-test/t/key.test:
Bug 20604:
The minimal test case that reveals the bug. The optimizer for
aggregates relies on keys disabled with ALTER TABLE ... DISABLE KEYS
not being in the set TABLE::keys_in_use_for_query.
When the execution engine tries to use a disabled index, MyISAM
returns an error.
mysql-test/t/myisam.test:
Bug #28476: test cases
sql/sql_base.cc:
Bug #28476:
- Ignore disabled indexes in USE/FORCE index
sql/sql_select.cc:
Bug 20604 : The intersection operation between table->s->keys_in_use
and table->keys_in_use_for_query is no longer necessary.
We can trust that the latter is a subset of the former.
sql/table.h:
Bug 20604:
Added comments to TABLE_SHARE::keys_in_use and
TABLE::keys_in_use_for_query.
Diffstat (limited to 'sql/table.h')
-rw-r--r-- | sql/table.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sql/table.h b/sql/table.h index 61232a39f0e..ebcafbd4dc7 100644 --- a/sql/table.h +++ b/sql/table.h @@ -137,7 +137,12 @@ typedef struct st_table_share const char *table_name; /* Table name (for open) */ const char *path; /* Path to .frm file (from datadir) */ LEX_STRING connect_string; - key_map keys_in_use; /* Keys in use for table */ + + /* + Set of keys in use, implemented as a Bitmap. + Excludes keys disabled by ALTER TABLE ... DISABLE KEYS. + */ + key_map keys_in_use; key_map keys_for_keyread; ulong avg_row_length; /* create information */ ulong raid_chunksize; @@ -206,7 +211,21 @@ struct st_table { byte *record[2]; /* Pointer to records */ byte *insert_values; /* used by INSERT ... UPDATE */ - key_map quick_keys, used_keys, keys_in_use_for_query; + key_map quick_keys, used_keys; + + /* + A set of keys that can be used in the query that references this + table + + All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be + subtracted from this set upon instantiation. Thus for any TABLE t it holds + that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we + must not introduce any new keys here (see setup_tables). + + The set is implemented as a bitmap. + */ + key_map keys_in_use_for_query; + key_map merge_keys; KEY *key_info; /* data of keys in database */ Field *next_number_field, /* Set if next_number is activated */ |