From b22e9a65407b43a89e2caa21bb94da972d591397 Mon Sep 17 00:00:00 2001 From: "dongxiang.zheng" Date: Wed, 17 Mar 2021 18:05:07 +0800 Subject: [PATCH] For some special,we want to know all the request more detail,many like slowlog,rather than genlog,but some time It's difficult to reconnect all client --- sql/log.cc | 4 +++- sql/sql_class.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 744947a6f8f0..e3eae2dc849b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1701,7 +1701,9 @@ bool log_slow_applicable(THD *thd) bool log_this_query= ((thd->server_status & SERVER_QUERY_WAS_SLOW) || warn_no_index) && (thd->get_examined_row_count() >= - thd->variables.min_examined_row_limit); + (global_system_variables.min_examined_row_limit <= 1 + ? global_system_variables.min_examined_row_limit + : thd->variables.min_examined_row_limit)); bool suppress_logging= log_throttle_qni.log(thd, warn_no_index); if (!suppress_logging && log_this_query) diff --git a/sql/sql_class.h b/sql/sql_class.h index 41d776338da8..fe97a9082356 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3309,7 +3309,8 @@ class THD :public MDL_context_owner, void update_server_status() { ulonglong end_utime_of_query= current_utime(); - if (end_utime_of_query > utime_after_lock + variables.long_query_time) + ulonglong my_long_query_time=global_system_variables.min_examined_row_limit<=1?global_system_variables.long_query_time:variables.long_query_time; + if (end_utime_of_query > utime_after_lock + my_long_query_time) server_status|= SERVER_QUERY_WAS_SLOW; } inline ulonglong found_rows(void)