From: Date: January 18 2007 3:50pm Subject: bk commit into 5.0 tree (cmiller:1.2359) BUG#24822 List-Archive: http://lists.mysql.com/commits/18339 X-Bug: 24822 Message-Id: <20070118145020.A9B8A83049@zippy> Below is the list of changes that have just been committed into a local 5.0 repository of cmiller. When cmiller does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-01-18 09:50:16-05:00, cmiller@stripped +7 -0 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. BitKeeper/etc/collapsed@stripped, 2007-01-18 09:49:43-05:00, cmiller@stripped +2 -0 mysql-test/r/information_schema.result@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +7 -0 Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. mysql-test/t/information_schema.test@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +10 -3 Test new status variable. --- Override the post-flush value, as a second could pass between the two statements. sql/mysql_priv.h@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +1 -1 Add variable to hold previous flush time. sql/mysqld.cc@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +4 -2 Add variable to hold previous flush time. Insert name for referring to it, and initialize the value. sql/sql_show.cc@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +4 -0 Yield value of elapsed time since flush when asked. sql/structs.h@stripped, 2007-01-18 09:50:14-05:00, cmiller@stripped +1 -0 Add new show-flush-time to SHOW types enumeration. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: cmiller # Host: zippy.cornsilk.net # Root: /home/cmiller/work/mysql/mysql-5.0-community--bug24822 --- 1.427/sql/mysql_priv.h 2007-01-18 09:50:20 -05:00 +++ 1.428/sql/mysql_priv.h 2007-01-18 09:50:20 -05:00 @@ -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)]; --- 1.584/sql/mysqld.cc 2007-01-18 09:50:20 -05:00 +++ 1.585/sql/mysqld.cc 2007-01-18 09:50:20 -05:00 @@ -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 c 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); /* --- 1.335/sql/sql_show.cc 2007-01-18 09:50:20 -05:00 +++ 1.336/sql/sql_show.cc 2007-01-18 09:50:20 -05:00 @@ -1492,6 +1492,10 @@ static bool show_status_array(THD *thd, 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; --- 1.57/sql/structs.h 2007-01-18 09:50:20 -05:00 +++ 1.58/sql/structs.h 2007-01-18 09:50:20 -05:00 @@ -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, --- 1.19/BitKeeper/etc/collapsed 2007-01-18 09:50:20 -05:00 +++ 1.20/BitKeeper/etc/collapsed 2007-01-18 09:50:20 -05:00 @@ -32,3 +32,5 @@ 459c03b9N_mqF2XJKK6DwSrIt7e6_g 459c1965_BQMBzBO8S_gVqjTHYQrmw 459c2098XoAUsUn8N07IVRDD6CTM-A +459ea845XenN-uWqEM5LFvUT60tW_A +45af88c9RIIJWPfBxs3o7zekI-ELPQ --- 1.117/mysql-test/r/information_schema.result 2007-01-18 09:50:20 -05:00 +++ 1.118/mysql-test/r/information_schema.result 2007-01-18 09:50:20 -05:00 @@ -1269,3 +1269,10 @@ id select_type table type possible_keys 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 # --- 1.88/mysql-test/t/information_schema.test 2007-01-18 09:50:20 -05:00 +++ 1.89/mysql-test/t/information_schema.test 2007-01-18 09:50:20 -05:00 @@ -971,9 +971,6 @@ SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), DROP TABLE bug23037; DROP FUNCTION get_value; - - - # # Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash # @@ -986,5 +983,15 @@ order by object_schema; 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.