MySQL 8.0.40
Source Code Documentation
|
In respect to the organization of modules, this really belongs in terminology_use_previous.h. More...
Classes | |
struct | compatible_name_t |
Encapsulates a <name, version> pair, holding an instrumentation name, and the version before which it was in use by the server. More... | |
Enumerations | |
enum | enum_compatibility_version { NONE , BEFORE_8_0_26 } |
Enumeration holding the possible values for @terminology_use_previous. More... | |
Functions | |
compatible_name_t | lookup (PFS_class_type class_type, std::string str, bool use_prefix=true) |
For a given PFS_class_type, and a name within that class, return the version-dependent alias for that name. More... | |
bool | is_older_required (enum_compatibility_version version) |
Checks the session variable @session.terminology_use_previous, to determine whether an instrumented object that was renamed in the given version should use the old name. More... | |
In respect to the organization of modules, this really belongs in terminology_use_previous.h.
However, that would create a cyclic dependency between header files:
So we keep enum_compatibility_version in its own header, included from both the other headers, to avoid the cyclicity.
bool terminology_use_previous::is_older_required | ( | enum_compatibility_version | version | ) |
Checks the session variable @session.terminology_use_previous, to determine whether an instrumented object that was renamed in the given version should use the old name.
version | The version where the instrumentation name was renamed. |
true | The old instrumentation name should be used. |
false | The new instrumentation name should be used. |
compatible_name_t terminology_use_previous::lookup | ( | PFS_class_type | class_type, |
std::string | str, | ||
bool | use_prefix = true |
||
) |
For a given PFS_class_type, and a name within that class, return the version-dependent alias for that name.
This is used when registering performance_schema names, to check if there are any alternative names. If there are, those are stored in the PFS_instr_class object. Later, when the name is required (e.g. during the execution of SELECT * FROM performance_schema.threads statement), it decides which name to use based on the value of @session.terminology_use_previous and the fields that were stored in PFS_instr_class.
This framework is extensible, so in future versions we can rename more names, and user will be able to choose exactly which version's names will be used. However, note that the framework currently does not support successive changes of the same identifier. This limitation allows us to return just a singleton compatible_name_t from this function. If, in the future, we need to make successive changes to the same identifier, this function needs to be changed so that it returns something like a std::map<ulong, char*>, for a given instrumented object mapping versions to alternative names.
class_type | The PFS_class_type of 'str', indicating whether it is a mutex/rwlock/condition variable/memory allocation/thread name/thread stage/thread command/etc. |
str | The object name to check. |
use_prefix | If true, 'str' is expected to begin with the prefix for 'class_type', and the return value will include the prefix. If false, 'str' is not expected to begin with the prefix and the return value will not include the prefix. |
A | compatible_name_t object. If there is an alternative name, 'old_name' points to a static buffer containing that name, and 'version' represents the enum_compatibility_version where that name was introduced. If there is no alternative name, 'old_name' is nullptr and version is 0. |