Accessing MySQL internals
One of the important use cases for the Information Schema plugin is to provide more server diagnostics to the user, that is, to expose the data about the MySQL internals. To do it we need to be able to find and use the internal data structures. Of course MySQL is an open source project and we can see where the data is that we need to capture. Typically, the data we need will be declared in the sql/
directory of the source code, but sometimes they can be in mysys/
or elsewhere.
In order to access the internals we need to define a MYSQL_SERVER
macro that the server uses internally to see all of the declarations. Without it we only get a highly filtered view, appropriate for plugins. In particular, we need this macro to access the THD
object. There are other tricks that may be needed to get the data we want. For instance, we may want to make our plugin access a private class member, in which case we need to extend the class so there are public accessors for the private...