List:Commits« Previous MessageNext Message »
From:Patrick Crews Date:June 3 2009 8:32pm
Subject:bzr commit into mysql-5.0-bugteam branch (patrick.crews:2764) Bug#44961
View as plain text  
#At file:///Users/pcrews/usr/local/bin/data1/work/info_schema/mysql-5.0-bugteam/ based on revid:sergey.glukhov@stripped

 2764 Patrick Crews	2009-06-03
      Bug#44961 - Test "information_schema" not fit for community configuration
      
      Fixed the test to actually check the variable behavior and altered it
      so that it can be skipped gracefully in the event the variable is not present.
      
      Added a helper file to std_data and re-recorded the .result file to account 
      for the changes to the test.
      
      NOTE:  5.1 will have a different fix as it provides functionality 
             not present in 5.0 (will be easier / simpler)

    added:
      mysql-test/std_data/flush_uptime.sql
    modified:
      mysql-test/r/information_schema.result
      mysql-test/t/information_schema.test
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2009-05-12 13:14:23 +0000
+++ b/mysql-test/r/information_schema.result	2009-06-03 20:32:50 +0000
@@ -1318,6 +1318,19 @@ TABLE_PRIVILEGES	information_schema.TABL
 TRIGGERS	information_schema.TRIGGERS	1
 USER_PRIVILEGES	information_schema.USER_PRIVILEGES	1
 VIEWS	information_schema.VIEWS	1
+# Initial setup
+DROP TABLE IF EXISTS uptime_help;
+CREATE TABLE uptime_help (var_name varchar(50), var_value int);
+# We want this to be 1 at the end of the test
+SET @success = 0;
+# If this is *not* set to 1, it is likely that something went awry
+# During the testing of the Uptime_since_flush_status variable
+SELECT @success;
+@success
+1
+
+# Cleanup
+DROP TABLE uptime_help;
 create table t1(f1 int);
 create view v1 as select f1+1 as a from t1;
 create table t2 (f1 int, f2 int);

=== added file 'mysql-test/std_data/flush_uptime.sql'
--- a/mysql-test/std_data/flush_uptime.sql	1970-01-01 00:00:00 +0000
+++ b/mysql-test/std_data/flush_uptime.sql	2009-06-03 20:32:50 +0000
@@ -0,0 +1 @@
+SHOW GLOBAL STATUS WHERE VARIABLE_NAME = "Uptime_since_flush_status";

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2009-05-12 13:14:23 +0000
+++ b/mysql-test/t/information_schema.test	2009-06-03 20:32:50 +0000
@@ -1029,6 +1029,84 @@ where t.table_schema = 'information_sche
           group by c2.column_type order by num limit 1)
 group by t.table_name order by num1, t.table_name;
 
+# Bug#24822: Patch: uptime_since_flush_status
+#
+# NOTE (pcrews):  This is complicated due to the fix for
+# Bug#44961 - Test "information_schema" not fit for community configuration
+# We have to do the following to account for community vs. enterprise
+# versions of the server.
+# We are storing the output of SHOW GLOBAL STATUS for the uptime_since_flush_status
+# variable into the table uptime_help, flushing the status variables, then
+# we repeat this.  We then compare the intial and final values to ensure
+# that the variable was properly updated after the FLUSH STATUS statement
+
+# In the event this is an enterprise server / the variable is not present,
+# The test will still return a positive value so as not to require extra
+# result files.
+
+
+--echo # Initial setup
+--disable_warnings
+DROP TABLE IF EXISTS uptime_help;
+--enable_warnings
+# we load the SHOW GLOBAL STATUS output into this table
+CREATE TABLE uptime_help (var_name varchar(50), var_value int);
+# we save the SHOW GLOBAL STATUS outuput here before moving to the table
+let $outfile = $MYSQL_VARDIR/tmp/i_s_tmp_file.dat;
+--echo # We want this to be 1 at the end of the test
+SET @success = 0;
+
+--disable_warnings
+--disable_query_log
+# Execute a SHOW GLOBAL STATUS command and store it to a file
+--exec $MYSQL --force -uroot test <  std_data/flush_uptime.sql > $outfile
+
+# Load the file contents into the helper table
+eval LOAD DATA LOCAL INFILE "$outfile" INTO TABLE uptime_help;
+
+# Capture the initial value of the variable under test
+let $init_value = query_get_value(SELECT var_value FROM uptime_help
+                  WHERE var_name = "Uptime_since_flush_status", var_value,1);
+
+# Determine if the variable is present in this version of the server
+# The row_count variable will be > 0 if it is
+# Possible TODO - throw and error if the server is a Community build
+# and the variable is not present
+
+SELECT COUNT(*) FROM uptime_help INTO @row_count;
+# If the variable is present, we repeat the process to compare
+# the variable values before and after a FLUSH STATUS statement
+
+if(@row_count)
+{
+flush status;
+DELETE FROM uptime_help;
+
+# Same process as before
+--exec $MYSQL --force -uroot test <  std_data/flush_uptime.sql > $outfile
+eval LOAD DATA LOCAL INFILE "$outfile" INTO TABLE uptime_help;
+let $cur_value = query_get_value(SELECT var_value FROM uptime_help
+                  WHERE var_name = "Uptime_since_flush_status", var_value,1);
+
+# Determine if the current value is smaller than the initial value - it should be
+eval SELECT $cur_value <= $init_value INTO @success;
+}
+# This is a 'pass' if we didn't detect the variable's presence
+if(!@row_count)
+{
+SET @success = 1;
+}
+--enable_query_log
+--enable_warnings
+--echo # If this is *not* set to 1, it is likely that something went awry
+--echo # During the testing of the Uptime_since_flush_status variable
+SELECT @success;
+
+--echo
+--echo # Cleanup
+DROP TABLE uptime_help;
+--remove_file $outfile
+
 
 #
 # Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong


Attachment: [text/bzr-bundle] bzr/patrick.crews@sun.com-20090603203250-of83q8vfk7ho4t14.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (patrick.crews:2764) Bug#44961Patrick Crews3 Jun