Commit 9c6ad3d0 authored by Igor Babaev's avatar Igor Babaev

Merge

parents d210e5fd e16081e1
...@@ -1749,7 +1749,8 @@ t1 CREATE TABLE `t1` ( ...@@ -1749,7 +1749,8 @@ t1 CREATE TABLE `t1` (
`COMMAND` varchar(16) NOT NULL DEFAULT '', `COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` int(7) NOT NULL DEFAULT '0', `TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL, `STATE` varchar(64) DEFAULT NULL,
`INFO` longtext `INFO` longtext,
`TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
) DEFAULT CHARSET=utf8 ) DEFAULT CHARSET=utf8
drop table t1; drop table t1;
create temporary table t1 like information_schema.processlist; create temporary table t1 like information_schema.processlist;
...@@ -1763,7 +1764,8 @@ t1 CREATE TEMPORARY TABLE `t1` ( ...@@ -1763,7 +1764,8 @@ t1 CREATE TEMPORARY TABLE `t1` (
`COMMAND` varchar(16) NOT NULL DEFAULT '', `COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` int(7) NOT NULL DEFAULT '0', `TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL, `STATE` varchar(64) DEFAULT NULL,
`INFO` longtext `INFO` longtext,
`TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
) DEFAULT CHARSET=utf8 ) DEFAULT CHARSET=utf8
drop table t1; drop table t1;
create table t1 like information_schema.character_sets; create table t1 like information_schema.character_sets;
......
...@@ -1380,6 +1380,17 @@ select user,db from information_schema.processlist; ...@@ -1380,6 +1380,17 @@ select user,db from information_schema.processlist;
user db user db
user3148 test user3148 test
drop user user3148@localhost; drop user user3148@localhost;
SELECT 'other connection here' AS who;
who
other connection here
SELECT IF(`time` > 0, 'OK', `time`) AS time_low,
IF(`time` < 1000, 'OK', `time`) AS time_high,
IF(time_ms > 900, 'OK', time_ms) AS time_ms_low,
IF(time_ms < 1000000, 'OK', time_ms) AS time_ms_high
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID=@tid;
time_low time_high time_ms_low time_ms_high
OK OK OK OK
DROP TABLE IF EXISTS server_status; DROP TABLE IF EXISTS server_status;
DROP EVENT IF EXISTS event_status; DROP EVENT IF EXISTS event_status;
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
...@@ -1602,8 +1613,7 @@ CREATE_OPTIONS ...@@ -1602,8 +1613,7 @@ CREATE_OPTIONS
key_block_size=1 key_block_size=1
DROP TABLE t1; DROP TABLE t1;
SET TIMESTAMP=@@TIMESTAMP + 10000000; SET TIMESTAMP=@@TIMESTAMP + 10000000;
SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0; SELECT 'NOT_OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
TEST_RESULT TEST_RESULT
OK
SET TIMESTAMP=DEFAULT; SET TIMESTAMP=DEFAULT;
End of 5.1 tests. End of 5.1 tests.
...@@ -1098,6 +1098,25 @@ connection default; ...@@ -1098,6 +1098,25 @@ connection default;
disconnect con3148; disconnect con3148;
drop user user3148@localhost; drop user user3148@localhost;
#
# `time` and `time_ms` columns of INFORMATION_SCHEMA.PROCESSLIST.
#
connect (pslistcon,localhost,root,,test);
let $ID= `select connection_id()`;
SELECT 'other connection here' AS who;
connection default;
sleep 1;
--disable_query_log
eval SET @tid=$ID;
--enable_query_log
SELECT IF(`time` > 0, 'OK', `time`) AS time_low,
IF(`time` < 1000, 'OK', `time`) AS time_high,
IF(time_ms > 900, 'OK', time_ms) AS time_ms_low,
IF(time_ms < 1000000, 'OK', time_ms) AS time_ms_high
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID=@tid;
disconnect pslistcon;
# #
# Bug#26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS # Bug#26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS
# in Event (see also openssl_1.test) # in Event (see also openssl_1.test)
...@@ -1352,9 +1371,16 @@ DROP TABLE t1; ...@@ -1352,9 +1371,16 @@ DROP TABLE t1;
# Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems # Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems
# to become negative # to become negative
# #
# Note that at the time of writing, MariaDB differs in behaviour from MySQL on
# the `time` column. In MySQL this changes depending on the setting of
# @TIMESTAMP, which is contrary to the documented (and sensible) behaviour.
# In MariaDB, the `time` column is independent of @TIMESTAMP.
# (The rationale for this is to keep `time` and `time_ms` consistent;
# @TIMESTAMP has no microsecond precision).
#
SET TIMESTAMP=@@TIMESTAMP + 10000000; SET TIMESTAMP=@@TIMESTAMP + 10000000;
SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0; SELECT 'NOT_OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
SET TIMESTAMP=DEFAULT; SET TIMESTAMP=DEFAULT;
--echo End of 5.1 tests. --echo End of 5.1 tests.
......
...@@ -32,7 +32,7 @@ select 1; ...@@ -32,7 +32,7 @@ select 1;
## End of 4.1 tests ## End of 4.1 tests
# #
#prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' '; #prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
#--replace_column 1 number 6 time 3 localhost #--replace_column 1 number 6 time 3 localhost 9 time_ms
#execute stmt1; #execute stmt1;
#deallocate prepare stmt1; #deallocate prepare stmt1;
......
...@@ -1819,7 +1819,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -1819,7 +1819,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
TABLE *table= tables->table; TABLE *table= tables->table;
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
char *user; char *user;
time_t now= my_time(0); ulonglong unow= my_micro_time();
DBUG_ENTER("fill_process_list"); DBUG_ENTER("fill_process_list");
user= thd->security_ctx->master_access & PROCESS_ACL ? user= thd->security_ctx->master_access & PROCESS_ACL ?
...@@ -1877,8 +1877,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -1877,8 +1877,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[4]->store(command_name[tmp->command].str, table->field[4]->store(command_name[tmp->command].str,
command_name[tmp->command].length, cs); command_name[tmp->command].length, cs);
/* MYSQL_TIME */ /* MYSQL_TIME */
table->field[5]->store((longlong)(tmp->start_time ? const ulonglong utime= tmp->start_utime ? unow - tmp->start_utime : 0;
now - tmp->start_time : 0), FALSE); table->field[5]->store(utime / 1000000, TRUE);
/* STATE */ /* STATE */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
val= (char*) (tmp->locked ? "Locked" : val= (char*) (tmp->locked ? "Locked" :
...@@ -1912,6 +1912,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -1912,6 +1912,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[7]->set_notnull(); table->field[7]->set_notnull();
} }
/* TIME_MS */
table->field[8]->store((double)(utime / 1000.0));
if (schema_table_store_record(thd, table)) if (schema_table_store_record(thd, table))
{ {
VOID(pthread_mutex_unlock(&LOCK_thread_count)); VOID(pthread_mutex_unlock(&LOCK_thread_count));
...@@ -5542,7 +5545,7 @@ ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx) ...@@ -5542,7 +5545,7 @@ ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx)
into it two numbers, based on modulus of base-10 numbers. In the ones into it two numbers, based on modulus of base-10 numbers. In the ones
position is the number of decimals. Tens position is unused. In the position is the number of decimals. Tens position is unused. In the
hundreds and thousands position is a two-digit decimal number representing hundreds and thousands position is a two-digit decimal number representing
length. Encode this value with (decimals*100)+length , where length. Encode this value with (length*100)+decimals , where
0<decimals<10 and 0<=length<100 . 0<decimals<10 and 0<=length<100 .
@param @param
...@@ -6557,6 +6560,8 @@ ST_FIELD_INFO processlist_fields_info[]= ...@@ -6557,6 +6560,8 @@ ST_FIELD_INFO processlist_fields_info[]=
{"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", 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", {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
SKIP_OPEN_TABLE}, SKIP_OPEN_TABLE},
{"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
0, 0, "Time_ms", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment