-
Marc Alff authored
Problem ======= When a metadata lock is taken for a TRANSACTION duration, and later modified with an EXPLICIT duration, which for example happens with RENAME TABLE, the table performance_schema.metadata_locks did not show the correct lock DURATION. Root cause ========== The code in sql/mdl.cc is not instrumented to update the duration in the performance schema instrumentation, and beside, the instrumentation does not provide an api to do so. Fix === For components: Add a set_metadata_lock_duration() instrumentation api in the psi_mdl service, and increment the service version to psi_mdl_v2. For plugins or server code: Add a set_metadata_lock_duration() instrumentation api in struct PSI_mdl_service, and increment version to PSI_mdl_service_v2. Implement a mysql_mdl_set_duration() helper. Call mysql_mdl_set_duration() from MDL_context::set_lock_duration(). Supporting all the combinations for services / plugins, and for versions 1 and 2 is not strictly necessary, given that there is only one known caller of the metadata lock instrumentation (in sql/mdl.cc), this is done to have a reference implementation using versions in the code base. Backward compatibility for any callers is provided. Approved by: Chris Powers <chris.powers@oracle.com>
Marc Alff authoredProblem ======= When a metadata lock is taken for a TRANSACTION duration, and later modified with an EXPLICIT duration, which for example happens with RENAME TABLE, the table performance_schema.metadata_locks did not show the correct lock DURATION. Root cause ========== The code in sql/mdl.cc is not instrumented to update the duration in the performance schema instrumentation, and beside, the instrumentation does not provide an api to do so. Fix === For components: Add a set_metadata_lock_duration() instrumentation api in the psi_mdl service, and increment the service version to psi_mdl_v2. For plugins or server code: Add a set_metadata_lock_duration() instrumentation api in struct PSI_mdl_service, and increment version to PSI_mdl_service_v2. Implement a mysql_mdl_set_duration() helper. Call mysql_mdl_set_duration() from MDL_context::set_lock_duration(). Supporting all the combinations for services / plugins, and for versions 1 and 2 is not strictly necessary, given that there is only one known caller of the metadata lock instrumentation (in sql/mdl.cc), this is done to have a reference implementation using versions in the code base. Backward compatibility for any callers is provided. Approved by: Chris Powers <chris.powers@oracle.com>
Loading