diff --git a/BitKeeper/etc/collapsed b/BitKeeper/etc/collapsed index e754ac133ea..43292906ddd 100644 --- a/BitKeeper/etc/collapsed +++ b/BitKeeper/etc/collapsed @@ -32,3 +32,5 @@ 459c03b9N_mqF2XJKK6DwSrIt7e6_g 459c1965_BQMBzBO8S_gVqjTHYQrmw 459c2098XoAUsUn8N07IVRDD6CTM-A +459ea845XenN-uWqEM5LFvUT60tW_A +45af88c9RIIJWPfBxs3o7zekI-ELPQ diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 21d7bfb1b21..d4fd536003a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1269,3 +1269,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY 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 # diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 623ccee49e4..a4cf3b497be 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -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. diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b28e885e2a5..e8fd84beaf9 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -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)]; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 95de1f91ecf..4a07cd0be0d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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); /* diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ac3acd5c986..0a39640aa4f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -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; diff --git a/sql/structs.h b/sql/structs.h index 2dcafdef615..4bb4d625cb4 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -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,