List:Internals« Previous MessageNext Message »
From:Ron Hu Date:March 11 2009 1:50am
Subject:Is active_index thread safe?
View as plain text  
Hi,

active_index is a class member variable in MySQL's handler class.  MySQL
query processor uses this variable to tell storage engine which index id it
is using for a given table.  Storage engine may override the index id used
for a given table used in a SQL statement by assigning a specific index id
to active_index.

I observed that an instance of handler object is created for each table
descriptor.  A table handler may be shared by two concurrent users if they
access same table at the same time.  Suppose a table t1 has two indexes idx1
and idx2.  User 1 needs to use idx1 while user 2 needs to use idx2.  If
these two users run their queries concurrently, how can MySQL and storage
engine guarantee the right active_index value is used for two concurrent
users?

Any pointer will be appreciated.

Thanks.

  -Ron


Thread
Is active_index thread safe?Ron Hu11 Mar
  • Re: Is active_index thread safe?Sergei Golubchik11 Mar
    • RE: Is active_index thread safe?Ron Hu11 Mar
      • Re: Is active_index thread safe?MARK CALLAGHAN11 Mar
      • Re: Is active_index thread safe?Sergei Golubchik12 Mar
        • Is handler object shared by two concurrent users?Ron Hu12 Mar
          • Re: Is handler object shared by two concurrent users?Sergei Golubchik16 Mar
            • RE: Is handler object shared by two concurrent users?Ron Hu16 Mar
    • RE: Is active_index thread safe? --ResendRon Hu11 Mar