summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-02-01 18:00:16 +0100
committerSergei Golubchik <serg@mariadb.org>2017-02-13 18:12:05 +0100
commit3cae225b0ff8751a5708bfe4ab0cf52b1badc37e (patch)
treed2ce0640322a1f3e64c2d0c5ca258fdd20b08694 /sql/key.cc
parent9fa6589f64654642543c88a53dfba8c4ef5a215e (diff)
downloadmariadb-git-3cae225b0ff8751a5708bfe4ab0cf52b1badc37e.tar.gz
cleanup: remove TABLE::add_read_columns_used_by_index
TABLE::add_read_columns_used_by_index() is conceptually wrong, it *adds* columns used by index to the bitmap, without clearing it first. But it also enables keyread, meaning that *only* columns from the index will be read. It is supposed to be used to add columns used by an index to a bitmap that already has columns of a primary key - for engines where a primary key is part of every index. The correct fix is to change mark_columns_used_by_index() to take into account extended keys. this reverts 1d0acc7754a44613d2ad and cf97cbd1db762c443aa3
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc12
1 files changed, 1 insertions, 11 deletions
diff --git a/sql/key.cc b/sql/key.cc
index 31b65adabe9..3bb009fcac9 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -467,17 +467,7 @@ bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields)
{
bitmap_clear_all(&table->tmp_set);
table->mark_columns_used_by_index_no_reset(idx, &table->tmp_set);
- if (bitmap_is_overlapping(&table->tmp_set, fields))
- return 1;
-
- /*
- If table handler has primary key as part of the index, check that primary
- key is not updated
- */
- if (idx != table->s->primary_key && table->s->primary_key < MAX_KEY &&
- (table->file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX))
- return is_key_used(table, table->s->primary_key, fields);
- return 0;
+ return bitmap_is_overlapping(&table->tmp_set, fields);
}