mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix bug #53496 Use Lock_time in slow query log output for InnoDB row
lock wait time. Including the InnoDB lock time in the exiting "Lock_time" output.
This commit is contained in:
@ -528,6 +528,7 @@ long long thd_test_options(const MYSQL_THD thd, long long test_options);
|
||||
int thd_sql_command(const MYSQL_THD thd);
|
||||
const char *thd_proc_info(MYSQL_THD thd, const char *info);
|
||||
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
|
||||
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
|
||||
int thd_tx_isolation(const MYSQL_THD thd);
|
||||
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
|
||||
unsigned int max_query_len);
|
||||
|
@ -154,6 +154,7 @@ long long thd_test_options(const void* thd, long long test_options);
|
||||
int thd_sql_command(const void* thd);
|
||||
const char *thd_proc_info(void* thd, const char *info);
|
||||
void **thd_ha_data(const void* thd, const struct handlerton *hton);
|
||||
void thd_storage_lock_wait(void* thd, long long value);
|
||||
int thd_tx_isolation(const void* thd);
|
||||
char *thd_security_context(void* thd, char *buffer, unsigned int length,
|
||||
unsigned int max_query_len);
|
||||
|
@ -307,6 +307,11 @@ void **thd_ha_data(const THD *thd, const struct handlerton *hton)
|
||||
return (void **) &thd->ha_data[hton->slot].ha_ptr;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void thd_storage_lock_wait(THD *thd, long long value)
|
||||
{
|
||||
thd->utime_after_lock+= value;
|
||||
}
|
||||
|
||||
/**
|
||||
Provide a handler data getter to simplify coding
|
||||
|
@ -1505,7 +1505,7 @@ public:
|
||||
// track down slow pthread_create
|
||||
ulonglong prior_thr_create_utime, thr_create_utime;
|
||||
ulonglong start_utime, utime_after_lock;
|
||||
|
||||
|
||||
thr_lock_type update_lock_default;
|
||||
Delayed_insert *di;
|
||||
|
||||
|
@ -807,6 +807,20 @@ thd_lock_wait_timeout(
|
||||
return(THDVAR((THD*) thd, lock_wait_timeout));
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Set the time waited for the lock for the current query. */
|
||||
extern "C" UNIV_INTERN
|
||||
void
|
||||
thd_set_lock_wait_time(
|
||||
/*===================*/
|
||||
void* thd, /*!< in: thread handle (THD*) */
|
||||
ulint value) /*!< in: time waited for the lock */
|
||||
{
|
||||
if (thd) {
|
||||
thd_storage_lock_wait((THD*)thd, value);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Obtain the InnoDB transaction of a MySQL thread.
|
||||
@return reference to transaction pointer */
|
||||
|
@ -267,5 +267,13 @@ thd_lock_wait_timeout(
|
||||
/*==================*/
|
||||
void* thd); /*!< in: thread handle (THD*), or NULL to query
|
||||
the global innodb_lock_wait_timeout */
|
||||
/******************************************************************//**
|
||||
Add up the time waited for the lock for the current query. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
thd_set_lock_wait_time(
|
||||
/*===================*/
|
||||
void* thd, /*!< in: thread handle (THD*) */
|
||||
ulint value); /*!< in: time waited for the lock */
|
||||
|
||||
#endif
|
||||
|
@ -1643,6 +1643,9 @@ srv_suspend_mysql_thread(
|
||||
start_time != -1 && finish_time != -1) {
|
||||
srv_n_lock_max_wait_time = diff_time;
|
||||
}
|
||||
|
||||
/* Record the lock wait time for this thread */
|
||||
thd_set_lock_wait_time(trx->mysql_thd, diff_time);
|
||||
}
|
||||
|
||||
if (trx->was_chosen_as_deadlock_victim) {
|
||||
|
Reference in New Issue
Block a user