List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:March 13 2009 2:26pm
Subject:bzr commit into mysql-5.1-bugteam branch (joro:2839) Bug#22047
View as plain text  
#At file:///home/kgeorge/mysql/work/B22047-5.1-bugteam/ based on revid:joro@stripped

 2839 Georgi Kodinov	2009-03-13 [merge]
      Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems to 
      become negative
      
      - merged the fix to 5.1
      - extended to cover I_S.PROCESSLIST.TIME
      - Changed the column type of I_S.PROCESSLIST.TIME from LOGNLONG UNSIGNED
        to LONG (to match the SHOW PROCESSLIST type)
      - Added a test case

    modified:
      mysql-test/r/information_schema.result
      mysql-test/t/information_schema.test
      sql/sql_show.cc
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2009-02-10 10:23:47 +0000
+++ b/mysql-test/r/information_schema.result	2009-03-13 14:24:08 +0000
@@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_S
 CREATE_OPTIONS
 KEY_BLOCK_SIZE=1
 DROP TABLE t1;
+SET TIMESTAMP=@@TIMESTAMP + 10000000;
+SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
+TEST_RESULT
+OK
+SET TIMESTAMP=DEFAULT;
 End of 5.1 tests.

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2009-02-10 10:23:47 +0000
+++ b/mysql-test/t/information_schema.test	2009-03-13 14:24:08 +0000
@@ -1410,6 +1410,15 @@ CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1;
 SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
 DROP TABLE t1;
 
+#
+# Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems
+# to become negative
+#
+
+SET TIMESTAMP=@@TIMESTAMP + 10000000;
+SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
+SET TIMESTAMP=DEFAULT;
+
 --echo End of 5.1 tests.
 
 # Wait till all disconnects are completed

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-03-05 11:15:47 +0000
+++ b/sql/sql_show.cc	2009-03-13 14:24:08 +0000
@@ -1704,7 +1704,8 @@ void mysqld_list_processes(THD *thd,cons
   field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
   field->maybe_null=1;
   field_list.push_back(new Item_empty_string("Command",16));
-  field_list.push_back(new Item_return_int("Time",7, MYSQL_TYPE_LONG));
+  field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
+  field->unsigned_flag= 0;
   field_list.push_back(field=new Item_empty_string("State",30));
   field->maybe_null=1;
   field_list.push_back(field=new Item_empty_string("Info",max_query_length));
@@ -1797,7 +1798,7 @@ void mysqld_list_processes(THD *thd,cons
     else
       protocol->store(command_name[thd_info->command].str, system_charset_info);
     if (thd_info->start_time)
-      protocol->store((uint32) (now - thd_info->start_time));
+      protocol->store_long ((longlong) (now - thd_info->start_time));
     else
       protocol->store_null();
     protocol->store(thd_info->state_info, system_charset_info);
@@ -1872,8 +1873,8 @@ int fill_schema_processlist(THD* thd, TA
         table->field[4]->store(command_name[tmp->command].str,
                                command_name[tmp->command].length, cs);
       /* MYSQL_TIME */
-      table->field[5]->store((uint32)(tmp->start_time ?
-                                      now - tmp->start_time : 0), TRUE);
+      table->field[5]->store((longlong)(tmp->start_time ?
+                                      now - tmp->start_time : 0), FALSE);
       /* STATE */
 #ifndef EMBEDDED_LIBRARY
       val= (char*) (tmp->locked ? "Locked" :
@@ -6558,7 +6559,7 @@ ST_FIELD_INFO processlist_fields_info[]=
    SKIP_OPEN_TABLE},
   {"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE},
   {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE},
-  {"TIME", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Time", SKIP_OPEN_TABLE},
+  {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE},
   {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
   {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
    SKIP_OPEN_TABLE},


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090313142408-bvmajhsneisjw98s.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (joro:2839) Bug#22047Georgi Kodinov13 Mar