maria-developers team mailing list archive
Mailing list archive
Re: doubt about MDL
On Oct 13, Roberto Spadim wrote:
> hi guys, i'm reading https://github.com/MariaDB/server/blob/10.1/sql/mdl.h
> i'm with a doubt... today we have the metadata lock plugin to check what
> mdl we have...
> my doubt is, how to expose how many threads are sharing the mdl key, and
> how many threads are waiting the mdl key, should it be possible or only one
> threrad could use one mdl?
MDL_key is not a lock, it's just an object key - it specifies what
object is locked (or a lock is requested on).
Many threads can wait for the same object, of course.
Threads do not share the logical lock, if two threads got a shared lock
on some object - every thread got its own shared lock, not two threads
got the same lock. Logically. But in the code all these shared locks are
represented by one MDL_ticket object, not many.