List:Internals« Previous MessageNext Message »
From:Sergey Petrunya Date:July 27 2011 5:28pm
Subject:Re: what can a sequence of handler::index_XXX be interrupted by?
View as plain text  
On Tue, Jul 26, 2011 at 06:13:54PM -0400, Zardosht Kasheff wrote:
> For the last case, where we have:
> >    handlers[0]->index_XXX();
> >    handlers[1]->index_XXX();
> >    handlers[2]->index_XXX();
> >    handlers[0]->index_XXX();
> >    handlers[0]->index_XXX();
> >    handlers[1]->index_XXX();
> 
> I assume each of the handlers share the same thd object? So if I check
> the thd object for each of the handlers, I will get the same one?

Yes. handlers[i]->ha_thd() == handlers[j]->ha_thd() for any i and j.

> I guess here is another question. Is there any way for a handler with
> some thd object be blocked from executing until some operation with
> ANOTHER thd finishes. For instance, in the above example, handlers[1]
> cannot execute until handlers[0] performs its index_XXX function, but
> (I hope) they have the same thd.
 
Every query is executed by some particular thread, and all ha_xxx objects
used by a thread must have their thd equal to thread's thd. This means that
the blockings you're interested in cannot be caused by a single query.

As for multiple queries, I can only think of locking:
- If your storage engine's ha_xxx::store_lock() produces lock objects that are
  exclusive for one another, then the blocking may occur
- I suspect something similar can happen with DDL operations. if there is a
  DDL operation running, other threads won't be able to open the table until
  the DDL op has finished.

BR
 Sergey
-- 
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog
Thread
what can a sequence of handler::index_XXX be interrupted by?Zardosht Kasheff26 Jul
  • Re: what can a sequence of handler::index_XXX be interrupted by?Sergey Petrunya26 Jul
    • Re: what can a sequence of handler::index_XXX be interrupted by?Zardosht Kasheff27 Jul
      • Re: what can a sequence of handler::index_XXX be interrupted by?Sergey Petrunya27 Jul
        • Re: what can a sequence of handler::index_XXX be interrupted by?Zardosht Kasheff27 Jul
        • Re: what can a sequence of handler::index_XXX be interrupted by?Zardosht Kasheff27 Jul
          • Re: what can a sequence of handler::index_XXX be interrupted by?Zardosht Kasheff28 Jul
            • Re: what can a sequence of handler::index_XXX be interrupted by?Sergey Petrunya28 Jul
          • Re: what can a sequence of handler::index_XXX be interrupted by?Sergey Petrunya28 Jul
  • re: what can a sequence of handler::index_XXX be interrupted by?Michael Widenius26 Jul