diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-06-02 03:25:56 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-06-02 03:25:56 +0400 |
commit | c17216eed83f6fa790dc5a4f8c040bcd428b6374 (patch) | |
tree | c3d01ed7ce6983d89b70c403e8027795e7bc7ebc /sql/opt_range.cc | |
parent | 5b73a17b3ac6324f5d67c20fb6c2b8b06920444b (diff) | |
download | mariadb-git-c17216eed83f6fa790dc5a4f8c040bcd428b6374.tar.gz |
BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
- Set index columns to be read when using index_merge, even if TABLE->no_keyread is
set for the table (happens for multi-table UPDATEs)
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 4ffe184ca03..510feebfdd3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2029,7 +2029,24 @@ end: doing_key_read= 1; head->mark_columns_used_by_index(index); } + head->prepare_for_position(); + + if (head->no_keyread) + { + /* + We can get here when doing multi-table delete and having index_merge + condition on a table that we're deleting from. It probably doesn't make + sense to use index_merge, but de-facto it is used. + + When it is used, we need to index columns to be read (before maria-5.3, + read_multi_range_first() would set it). + We shouldn't call mark_columns_used_by_index(), because it calls + enable_keyread(), which is not allowed. + */ + head->mark_columns_used_by_index_no_reset(index, head->read_set); + } + head->file= org_file; head->key_read= org_key_read; bitmap_copy(&column_bitmap, head->read_set); |