diff options
author | Igor Babaev <igor@askmonty.org> | 2011-01-14 22:55:56 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-01-14 22:55:56 -0800 |
commit | 0aebdc115f9966d8356da3c384ad442699712ad5 (patch) | |
tree | 7a1e7b8a8cd0f7ae6f067db5ce0c02162151bd9e /sql/sql_join_cache.cc | |
parent | cb4fa7f401267bf887066100726c53f10b712e6d (diff) | |
download | mariadb-git-0aebdc115f9966d8356da3c384ad442699712ad5.tar.gz |
Ported the fix for LP bug #702310 / bug #59493.
An assertion failure was triggered for a 6-way join query that used two
join buffers.
The failure happened because every call of JOIN_CACHE::join_matching_records
saved and restored status of all tables that were accessed before the table
join_tab. It must do it only for those of them that follow the last table
using a join buffer.
Diffstat (limited to 'sql/sql_join_cache.cc')
-rw-r--r-- | sql/sql_join_cache.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 6c94ccede47..6e24af7a95e 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -3171,7 +3171,8 @@ uint JOIN_CACHE_HASHED::get_next_key(uchar ** key) int JOIN_TAB_SCAN::open() { - for (JOIN_TAB *tab= join->join_tab; tab != join_tab ; tab++) + JOIN_TAB *bound= join_tab-cache->tables; + for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--) { tab->status= tab->table->status; tab->table->status= 0; @@ -3246,7 +3247,8 @@ int JOIN_TAB_SCAN::next() void JOIN_TAB_SCAN::close() { - for (JOIN_TAB *tab= join->join_tab; tab != join_tab ; tab++) + JOIN_TAB *bound= join_tab-cache->tables; + for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--) tab->table->status= tab->status; } @@ -3647,7 +3649,8 @@ int JOIN_TAB_SCAN_MRR::open() /* Dynamic range access is never used with BKA */ DBUG_ASSERT(join_tab->use_quick != 2); - for (JOIN_TAB *tab =join->join_tab; tab != join_tab ; tab++) + JOIN_TAB *bound= join_tab-cache->tables; + for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--) { tab->status= tab->table->status; tab->table->status= 0; |