← Back to team overview

maria-developers team mailing list archive

Re: SHOW EXPLAIN and LOCK_thd_data

 

Hi, Sergei!

On May 26, Sergei Petrunia wrote:
> I've got a problem with SHOW EXPLAIN and LOCK_thd_data.
> 
> SHOW EXPLAIN was modeled after the KILL command: it's actions are:
> 
>   lock LOCK_thread_count;
>   find the thread $target_thr we need explain for;
>   lock $target_thr->LOCK_thd_data;
>   unlock LOCK_thread_count;
> 
>   send SHOW EXPLAIN request to $target_thr.
>   wait until request is executed (or discarded)
> 
>   unlock $target_thr->LOCK_thd_data;
> 
> This scheme works, as long as the target thread doesn't select 
> from information_schema tables. With queries over I_S tables, it breaks,
> because I_S table may try to acquire current_thd->LOCK_thd_data during 
> execution.

Why does it break?

If you've acquired thd->LOCK_thd_data before that I_S table query, then
it'll wait for you to release it. You release it when you start waiting.
And that I_S table query will continue executing, notice your request,
etc.

If it acquired the mutex before you, you'll wait till it's released,
that's all.

Regards,
Sergei


References