Re: what can a sequence of handler::index_XXX be interrupted by?

Sergey Petrunya <[email protected]>
Newsgroups gmane.comp.db.mysql.devel
Message-ID <20110727172822.GD8645@pslp2>
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

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.