* Zardosht Kasheff <zardosht@stripped> [09/09/29 19:33]:
> While implementing our storage engine's version of show engine status,
> I noticed that if the handlerton function show_status ever returns an
> error, this causes a crash in a debug build of mysqld, in protocol.cc
> line 416, in the following code:
>
> case Diagnostics_area::DA_EMPTY:
> default:
> DBUG_ASSERT(0);
>
> The reason is that the variable thd->main_da.status() is not set when
> this function is called.
>
> In the function ha_show_status, in handler.cc, I see the following
> code to end the function:
>
> if (!result)
> my_eof(thd);
> return result;
> }
>
> So, if the handlerton's show_status function successfully returns,
> my_eof(thd) is called, and the assert is not hit in protocol.cc.
> However, if show_status returns an error, then nothing is called here,
> causing the assert.
>
> That being said, what is the expected behavior here? Is the assumption
> that show_status can never return an error (and if so, then shouldn't
> show_status be a void function and not return a bool)? Is there
> something simple and safe that can be done that allows show_status to
> return an error in some cases, but not causing a crash? Perhaps:
>
> if (!result)
> my_eof(thd);
> else
> something_else;
> return result;
The code in SHOW STATUS needs to call file->print_error() in case
of an error. It probably doesn't do it, and that leads to a bug.
Perhaps you're the first engine that can return an error from show
status.
--