summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-03-13 15:51:25 +0200
committerGeorgi Kodinov <joro@sun.com>2009-03-13 15:51:25 +0200
commitf35b4218eaa2bf831ab682b3674851a1cc6ee65a (patch)
tree6db7cfa4edc15e85720d76cfe1d091f571b589ab /sql/sql_show.cc
parent510e9ddf36df94421f20e760225d69304f7a35f3 (diff)
downloadmariadb-git-f35b4218eaa2bf831ab682b3674851a1cc6ee65a.tar.gz
Bug #22047 : Time in SHOW PROCESSLIST for SQL thread in replication
seems to become negative THD::start_time has a dual meaning : it's either the time since the process entered a given state or is the transaction time returned by e.g. NOW(). This causes problems, as sometimes THD::start_time may be set to a value that is correct and needed when used as a base for NOW(), but these times may be arbitrary (SET @@timestamp) or non-local (coming from the master through the replication feed). If one such non-local time is set there's no way to return a correct value for e.g. SHOW PROCESSLIST or SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST. Fixed by making the Time column in SHOW PROCESSLIST SIGNED LONG instead of UNSIGNED LONG and doing the correct conversions. Note that no reliable test suite can be constructed, since it would require knowing the local time and can't be achieved by the means of the current test suite. sql/sql_show.cc: Bug #22047: make the Time in SHOW PROCESSLIST LONG from LONG UNSIGNED
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index a3ccf770a3c..fee3d076436 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1338,7 +1338,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
field_list.push_back(field=new Item_empty_string("db",NAME_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, FIELD_TYPE_LONG));
+ field_list.push_back(field= new Item_return_int("Time",7, FIELD_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));
@@ -1439,7 +1440,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store(command_name[thd_info->command], 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);