Re: [Maria-developers] Fwd: [Commits] Rev 2859: Fixed LP #bug 660963. in file:///home/igor/maria/maria-5.3-mwl128-bug660963/
Hello Igor, On Thu, Nov 18, 2010 at 02:17:13PM -0800, Igor Babaev wrote:
Sergey,
Please review this patch ASAP as this bug blocks Philip with testing. If you have any questions contact me by skype.
Ok to push after the comment below is addressed.
-------- Original Message -------- Subject: [Commits] Rev 2859: Fixed LP #bug 660963. in file:///home/igor/maria/maria-5.3-mwl128-bug660963/ Date: Thu, 18 Nov 2010 14:13:58 -0800 (PST) From: Igor Babaev <igor@askmonty.org> Reply-To: maria-developers@lists.launchpad.net To: <commits@mariadb.org>
At file:///home/igor/maria/maria-5.3-mwl128-bug660963/
------------------------------------------------------------ revno: 2859 revision-id: igor@askmonty.org-20101118221357-zg55d3erru07ugzy parent: igor@askmonty.org-20101116050732-hpbqelsf8nvae4xt committer: Igor Babaev <igor@askmonty.org> branch nick: maria-5.3-mwl128-bug660963 timestamp: Thu 2010-11-18 14:13:57 -0800 message: Fixed LP #bug 660963. The condition that was supposed to check whether a join table is an inner table of a nested outer join or semi-join was not quite correct in the code of the function check_join_cache_usage. That's why some queries with nested outer joins triggered an assertion failure. Encapsulated this condition in the new method called JOIN_TAB::is_nested_inner and provided a proper code for it.
Also corrected a bug in the code of check_join_cache_usage() that caused a downgrade of not first join buffers of the level 5 and 7 to level 4 and 6 correspondingly.
...
=== modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-11-16 05:07:32 +0000 +++ b/sql/sql_select.cc 2010-11-18 22:13:57 +0000 @@ -7635,8 +7635,7 @@ if (cache_level == 0 || i == join->const_tables || !prev_tab) return 0;
- if (force_unlinked_cache && - (cache_level & JOIN_CACHE_INCREMENTAL_BIT)) + if (force_unlinked_cache && (cache_level%2 == 0)) cache_level--;
if (options & SELECT_NO_JOIN_CACHE) @@ -7658,13 +7657,14 @@ /* Non-linked join buffers can't guarantee one match */ - if ((force_unlinked_cache || cache_level == 1) && - ((tab->is_inner_table_of_semi_join_with_first_match() && - !tab->is_single_inner_of_semi_join_with_first_match()) || - (tab->is_inner_table_of_outer_join() && - !tab->is_single_inner_of_outer_join()))) - goto no_join_cache; - + if (tab->is_nested_inner()) + { + if (force_unlinked_cache || cache_level == 1) + goto no_join_cache; + if (cache_level & 1) + cache_level--; + } + /* Don't use join buffering if we're dictated not to by no_jbuf_after (this ...) @@ -7757,9 +7757,6 @@ (cache_level <= 6 || no_hashed_cache)) goto no_join_cache;
- if (prev_tab->cache && cache_level==7) - cache_level= 6; - if ((rows != HA_POS_ERROR) && !(flags & HA_MRR_USE_DEFAULT_IMPL)) { if (cache_level <= 6 || no_hashed_cache)
=== modified file 'sql/sql_select.h' --- a/sql/sql_select.h 2010-11-13 14:13:34 +0000 +++ b/sql/sql_select.h 2010-11-18 22:13:57 +0000 @@ -359,6 +359,14 @@ return (first_inner && first_inner->last_inner == this) || last_sj_inner_tab == this; } + bool is_nested_inner() Please add a comment clarifying what this function checks.
+ { + if (first_inner && (first_inner != last_inner || first_upper)) + return TRUE; + if (first_sj_inner_tab && first_sj_inner_tab != last_sj_inner_tab) + return TRUE; + return FALSE; + } struct st_join_table *get_first_inner_table() { if (first_inner)
BR Sergey -- Sergey Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog
participants (1)
-
Sergey Petrunya