From: Zardosht Kasheff Date: July 27 2011 9:18pm Subject: Re: what can a sequence of handler::index_XXX be interrupted by? List-Archive: http://lists.mysql.com/internals/38370 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable One last question on this. Each of the handlers below in the index merge/intersection code. Will each of the handlers be calling index_XXX() on a different index? Or is it possible that two of them may be called on the same index? Thanks -Zardosht On Wed, Jul 27, 2011 at 1:28 PM, Sergey Petrunya wro= te: > On Tue, Jul 26, 2011 at 06:13:54PM -0400, Zardosht Kasheff wrote: >> For the last case, where we have: >> > =A0 =A0handlers[0]->index_XXX(); >> > =A0 =A0handlers[1]->index_XXX(); >> > =A0 =A0handlers[2]->index_XXX(); >> > =A0 =A0handlers[0]->index_XXX(); >> > =A0 =A0handlers[0]->index_XXX(); >> > =A0 =A0handlers[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() =3D=3D 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 th= at > 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 tha= t are > =A0exclusive for one another, then the blocking may occur > - I suspect something similar can happen with DDL operations. if there is= a > =A0DDL operation running, other threads won't be able to open the table u= ntil > =A0the DDL op has finished. > > BR > =A0Sergey > -- > Sergey Petrunia, Software Developer > Monty Program AB, http://askmonty.org > Blog: http://s.petrunia.net/blog >