Bug #35572 Incorrect logic in read_first_row following rnd_init failure
Submitted: 26 Mar 2008 13:43 Modified: 26 Mar 2008 16:30
Reporter: Tim Clark Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.22 OS:Other (i5/OS v5r4 PASE)
Assigned to: CPU Architecture:Any
Tags: ha_rnd_end, ha_rnd_init, read_first_row

[26 Mar 2008 13:43] Tim Clark
Description:
The ha_rnd_end() function will fail with a DBUG_ASSERT when called from handler::read_first_row after handler::rnd_init has returned a failure. 

read_first_row calls ha_rnd_init. ha_rnd_init honors the failure return code and sets handler::inited=NONE. However, read_first_row does not honor the return code from ha_rnd_init and calls rnd_next and then ha_rnd_end in all circumstances. ha_rnd_end then fails because inited != RND

Related to bug #24986

How to repeat:
Perform a left join on tables and force a non-zero return value from rnd_init.

Suggested fix:
Fix read_first_row to honor the return code from ha_rnd_init.
[26 Mar 2008 16:30] Susanne Ebrecht
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[26 Mar 2008 16:31] Susanne Ebrecht
The change set told me that mkindahl fixed this 2008-03-14.