If your storage engine returns an error from rnd_init (or doStartTableScan as it’s named in Drizzle) and does not save this error and return it in any subsequent calls to rnd_next, your engine is buggy. Namely it is buggy in that a) an error may not be reported back to the user and b) everything may explode horribly when rnd_next is called after rnd_init returned an error.
Unless it is running on MariaDB 5.2 or (soon, when the patch hits the tree) Drizzle.
Monty (Widenius, not Taylor) wrote a patch for MariaDB based on my bug report that addressed that problem. It uses the compiler feature to throw a warning if the result of a function isn’t checked to make sure that all places that call rnd_init are checking for an error from the engine.
Today I (finally) pulled that into Drizzle as well.
So… if your engine does the logical thing and goes “oh look, this method returns an error… I’ll return my error” it will exhibit bugs in MySQL but not MariaDB 5.2 or Drizzle (when patch hits).
Which is buggy, the server or the engine?
The MySQL bug number is 54166, filed in June 2010.
First!
http://bugs.mysql.com/bug.php?id=25058 (a few cases fixed)
http://bugs.mysql.com/bug.php?id=40492 (many more remain)