Jorgen Loland wrote:
> Martin,
>
> The fix looks correct, but since I was curious why the query was well
> behaving in next-mr I spent a few hours to realize that do_select()
> was restructured a bit by Kostja's patch:
>
> revno: 2630.13.6
> committer: Konstantin Osipov <konstantin@stripped>
> branch nick: mysql-6.0-3288
> timestamp: Fri 2008-07-11 20:22:44 +0400
> message:
> WL#3288, step 1: ensure that the SQL layer always closes an open
> cursor (rnd or index read) before closing a handler.
>
> In next-mr, the "if(table)" block is moved before the "if (error ==
> NESTED_LOOP_OK)" block, and in the else part of if(table), you find
>
> join->join_free();
>
> As I see it, Kostja's fix of do_select is exactly what you are looking
> for to fix this bug. If you backport that (at least the parts
> concerning do_select) instead of the patch you just committed, you'll
> also help align the 5.1 and next-mr codebases.
I find this too risky. The patch for the worklog switches the places of
if (error == NESTED_LOOP_OK) and if (table). This may or may not work in
5.1. In the future the worklog can always be back-ported anyway. I say
let's push to 5.1 only.
Best Regards
Martin