MySQL  8.0.28
Source Code Documentation
terminology_use_previous Namespace Reference

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, const 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...
 

Detailed Description

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:

  • enum_compatibility_version is needed in pfs_instr_class.h
  • PFS_class_type is defined in pfs_instr_class.h and needed in instrumentation_class_compatibility.h

So we keep enum_compatibility_version in its own header, included from both the other headers, to avoid the cyclicity.

Enumeration Type Documentation

◆ enum_compatibility_version

Enumeration holding the possible values for @terminology_use_previous.

Each element corresponds to a server release where some instrumentation name was changed.

Enumerator
NONE 

Use new names; do not provide backward compatibility.

BEFORE_8_0_26 

Use names that were in use up to 8.0.25, inclusive.

Function Documentation

◆ is_older_required()

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.

Parameters
versionThe version where the instrumentation name was renamed.
Return values
trueThe old instrumentation name should be used.
falseThe new instrumentation name should be used.

◆ lookup()

compatible_name_t terminology_use_previous::lookup ( PFS_class_type  class_type,
const 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.

Parameters
class_typeThe PFS_class_type of 'str', indicating whether it is a mutex/rwlock/condition variable/memory allocation/thread name/thread stage/thread command/etc.
strThe object name to check.
use_prefixIf 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.
Return values
Acompatible_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.