summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-03-17 16:29:16 +0200
committerGeorgi Kodinov <joro@sun.com>2009-03-17 16:29:16 +0200
commit7af84377cc19136067ff818322e27d5e15167202 (patch)
treeff528124dd951beb07cda51eb0d128cd5ea0c231
parentc14a43cd40012a41096fafe519a304adbab7e766 (diff)
parent8a5a804530eb0ee9c935b2b581d62ead93ae2854 (diff)
downloadmariadb-git-7af84377cc19136067ff818322e27d5e15167202.tar.gz
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
-rw-r--r--mysql-test/r/create.result4
-rw-r--r--mysql-test/r/information_schema.result5
-rw-r--r--mysql-test/t/information_schema.test9
-rw-r--r--sql/sql_show.cc11
4 files changed, 22 insertions, 7 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 057a8600ca2..bd11a8725ef 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1731,7 +1731,7 @@ t1 CREATE TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
- `TIME` bigint(7) NOT NULL DEFAULT '0',
+ `TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
@@ -1745,7 +1745,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
- `TIME` bigint(7) NOT NULL DEFAULT '0',
+ `TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 5dd0f159428..9a75e478264 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
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.
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index ef6e3eaca12..392d1062492 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -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
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3d702833620..d08b3a248c4 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1704,7 +1704,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
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,const char *user, bool verbose)
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, TABLE_LIST* tables, COND* cond)
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},