RAII based class to acquire and release schema meta data locks.
When an instance of this class is created, and 'ensure_lock()' is called, it will acquire an IX lock on the submitted schema name, unless we already have one. When the instance goes out of scope or is deleted, the ticket registered will be released.
- Note
- It is vital that the order of releasing and unlocking the schema is correct. The Schema_MDL_locker must always be declared before the corresponding Auto_releaser to make sure that the schema locker is deleted after the auto releaser. Otherwise, there will be situations where we have the schema object referenced locally, but without a meta data lock. This may, in turn, violate asserts in the shared cache, and open up for improper usage.