From: Zardosht Kasheff Date: July 28 2011 2:44am Subject: Re: what can a sequence of handler::index_XXX be interrupted by? List-Archive: http://lists.mysql.com/internals/38371 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Actually, let me put the question another way. Given that we have had one call of handler::index_init with some thd and keynr, are we guaranteed to NOT get another call to handler::index_init with the SAME thd and keynr, until we get a call to handler::index_end for the first call? Thanks -Zardosht On Wed, Jul 27, 2011 at 5:18 PM, Zardosht Kasheff wrot= e: > 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 w= rote: >> 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 object= s >> used by a thread must have their thd equal to thread's thd. This means t= hat >> 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 th= at are >> =A0exclusive for one another, then the blocking may occur >> - I suspect something similar can happen with DDL operations. if there i= s a >> =A0DDL operation running, other threads won't be able to open the table = until >> =A0the DDL op has finished. >> >> BR >> =A0Sergey >> -- >> Sergey Petrunia, Software Developer >> Monty Program AB, http://askmonty.org >> Blog: http://s.petrunia.net/blog >> >