mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Bug#24822: Patch: uptime_since_flush_status
Provide the number of seconds since flush as a new status variable named "Uptime_since_flush_status". --- Override the post-flush value, as a second could pass between the two statements. mysql-test/r/information_schema.result: Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. mysql-test/t/information_schema.test: Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. sql/mysql_priv.h: Add variable to hold previous flush time. sql/mysqld.cc: Add variable to hold previous flush time. Insert name for referring to it, and initialize the value. sql/sql_show.cc: Yield value of elapsed time since flush when asked. sql/structs.h: Add new show-flush-time to SHOW types enumeration.
This commit is contained in:
parent
bd2cc79a95
commit
351b966462
7 changed files with 29 additions and 6 deletions
|
@ -32,3 +32,5 @@
|
|||
459c03b9N_mqF2XJKK6DwSrIt7e6_g
|
||||
459c1965_BQMBzBO8S_gVqjTHYQrmw
|
||||
459c2098XoAUsUn8N07IVRDD6CTM-A
|
||||
459ea845XenN-uWqEM5LFvUT60tW_A
|
||||
45af88c9RIIJWPfBxs3o7zekI-ELPQ
|
||||
|
|
|
@ -1269,3 +1269,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED tables ALL NULL NULL NULL NULL 2
|
||||
drop view v1;
|
||||
show global status like "Uptime_%";
|
||||
Variable_name Value
|
||||
Uptime_since_flush_status #
|
||||
flush status;
|
||||
show global status like "Uptime_%";
|
||||
Variable_name Value
|
||||
Uptime_since_flush_status #
|
||||
|
|
|
@ -971,9 +971,6 @@ SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=
|
|||
DROP TABLE bug23037;
|
||||
DROP FUNCTION get_value;
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash
|
||||
#
|
||||
|
@ -987,4 +984,14 @@ explain select * from v1;
|
|||
explain select * from (select table_name from information_schema.tables) as a;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Bug#24822: Patch: uptime_since_flush_status
|
||||
#
|
||||
--replace_column 2 #
|
||||
show global status like "Uptime_%";
|
||||
flush status;
|
||||
--replace_column 2 #
|
||||
show global status like "Uptime_%"; # Almost certainly zero
|
||||
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
|
|
@ -1190,7 +1190,7 @@ void my_dbopt_free(void);
|
|||
External variables
|
||||
*/
|
||||
|
||||
extern time_t start_time;
|
||||
extern time_t start_time, flush_status_time;
|
||||
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
|
||||
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[],
|
||||
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
|
||||
|
|
|
@ -428,7 +428,7 @@ ulong expire_logs_days = 0;
|
|||
ulong rpl_recovery_rank=0;
|
||||
|
||||
double log_10[32]; /* 10 potences */
|
||||
time_t start_time;
|
||||
time_t start_time, flush_status_time;
|
||||
|
||||
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
|
||||
char *default_tz_name;
|
||||
|
@ -2589,7 +2589,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
|||
tzset(); // Set tzname
|
||||
|
||||
max_system_variables.pseudo_thread_id= (ulong)~0;
|
||||
start_time=time((time_t*) 0);
|
||||
start_time= flush_status_time= time((time_t*) 0);
|
||||
if (init_thread_environment())
|
||||
return 1;
|
||||
mysql_init_variables();
|
||||
|
@ -6264,6 +6264,7 @@ struct show_var_st status_vars[]= {
|
|||
{"Threads_created", (char*) &thread_created, SHOW_LONG_CONST},
|
||||
{"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
|
||||
{"Uptime", (char*) 0, SHOW_STARTTIME},
|
||||
{"Uptime_since_flush_status",(char*) 0, SHOW_FLUSHTIME},
|
||||
{NullS, NullS, SHOW_LONG}
|
||||
};
|
||||
|
||||
|
@ -7534,6 +7535,7 @@ void refresh_status(THD *thd)
|
|||
|
||||
/* Reset the counters of all key caches (default and named). */
|
||||
process_key_caches(reset_key_cache_counters);
|
||||
flush_status_time= time((time_t*) 0);
|
||||
pthread_mutex_unlock(&LOCK_status);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1492,6 +1492,10 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||
nr= (long) (thd->query_start() - start_time);
|
||||
end= int10_to_str(nr, buff, 10);
|
||||
break;
|
||||
case SHOW_FLUSHTIME:
|
||||
nr= (long) (thd->query_start() - flush_status_time);
|
||||
end= int10_to_str(nr, buff, 10);
|
||||
break;
|
||||
case SHOW_QUESTION:
|
||||
end= int10_to_str((long) thd->query_id, buff, 10);
|
||||
break;
|
||||
|
|
|
@ -174,6 +174,7 @@ enum SHOW_TYPE
|
|||
SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
|
||||
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
|
||||
SHOW_VARS,
|
||||
SHOW_FLUSHTIME,
|
||||
#ifdef HAVE_OPENSSL
|
||||
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
|
||||
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,
|
||||
|
|
Loading…
Reference in a new issue