Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
Metadata locking uses a class MDL_context_owner:
/**
|
An interface to separate the MDL module from the THD, and the rest of the
|
server code.
|
*/
|
 |
class MDL_context_owner {
|
...
|
virtual int is_killed() = 0;
|
virtual THD* get_thd() = 0;
|
class THD: public THD_count, /* this must be first */
|
...
|
public MDL_context_owner,
|
...
|
virtual int is_killed() { return killed; }
|
virtual THD* get_thd() { return this; }
|
It appears MDL_context_owner is only used as a base class of a THD object, in effect MDL_context_owner is a THD, as is also seen by the need to implement virtual functions such as get_thd().
Such virtual functions create run-time overhead (is_killed() is a frequently called function, for one), and needlessly complicate the code.
So let's remove this and make it clear in the code that MDL_context_owner is in fact a THD. For example by simply passing in THD instead of MDL_context_owner in the places that need to have a THD, or perhaps upcasting in get_thd(); in any case remove the virtual functions that only have a single implementation across the server code.