summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2010-10-06 18:03:27 -0600
committerMarc Alff <marc.alff@oracle.com>2010-10-06 18:03:27 -0600
commitd51cd894dac501d808da0c3bc08636f387014eb3 (patch)
tree1ae61e6cff185521683ed02b0ceefc681fb764e8
parent985fa88f8b07743dd3a848c11bc1d93b826d3d62 (diff)
downloadmariadb-git-d51cd894dac501d808da0c3bc08636f387014eb3.tar.gz
Bug#57154 Rename THREADS.ID to THREADS.PROCESSLIST_ID in 5.5
This change is to align the 5.5 performance_schema.THREADS table definition with the 5.6 performance_schema.THREADS table, to facilitate the 5.5 -> 5.6 migration later. In the table performance_schema.THREADS: - renamed ID to PROCESSLIST_ID, removed not null - changed NAME from varchar(64) to varchar(128) to match the columns definitions from 5.6 Adjusted the test cases accordingly. Note: this fix is for 5.5 only, to null merge into 5.6
-rw-r--r--mysql-test/suite/perfschema/include/setup_helper.inc12
-rw-r--r--mysql-test/suite/perfschema/r/dml_threads.result6
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result17
-rw-r--r--mysql-test/suite/perfschema/r/selects.result18
-rw-r--r--mysql-test/suite/perfschema/t/dml_threads.test8
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test46
-rw-r--r--mysql-test/suite/perfschema/t/selects.test16
-rw-r--r--mysql-test/suite/perfschema/t/thread_cache.test12
-rw-r--r--scripts/mysql_system_tables.sql4
-rw-r--r--storage/perfschema/table_threads.cc11
-rw-r--r--storage/perfschema/table_threads.h4
11 files changed, 70 insertions, 84 deletions
diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc
index 1c8d4e412d5..195b9cf960a 100644
--- a/mysql-test/suite/perfschema/include/setup_helper.inc
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
@@ -26,17 +26,17 @@ update performance_schema.SETUP_CONSUMERS set enabled='YES';
connect (con1, localhost, root, , );
let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+ where PROCESSLIST_ID = connection_id()`;
connect (con3, localhost, root, , );
let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID in (select connection_id())`;
+ where PROCESSLIST_ID = connection_id()`;
connection default;
diff --git a/mysql-test/suite/perfschema/r/dml_threads.result b/mysql-test/suite/perfschema/r/dml_threads.result
index b4fa8705c95..261e7977aa5 100644
--- a/mysql-test/suite/perfschema/r/dml_threads.result
+++ b/mysql-test/suite/perfschema/r/dml_threads.result
@@ -1,12 +1,12 @@
select * from performance_schema.THREADS
where name like 'Thread/%' limit 1;
-THREAD_ID ID NAME
+THREAD_ID PROCESSLIST_ID NAME
# # #
select * from performance_schema.THREADS
where name='FOO';
-THREAD_ID ID NAME
+THREAD_ID PROCESSLIST_ID NAME
insert into performance_schema.THREADS
-set name='FOO', thread_id=1, id=2;
+set name='FOO', thread_id=1, processlist_id=2;
ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
update performance_schema.THREADS
set thread_id=12;
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index 201254aca21..655ce1394f9 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -94,24 +94,9 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
WHERE COUNT_STAR > 0
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
-# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
-ORDER BY SUM_WAIT DESC
-LIMIT 20;
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
-HAVING BYTES > 0
-ORDER BY i.user, h.operation;
diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result
index dfc9007c740..6d596ba8d9a 100644
--- a/mysql-test/suite/perfschema/r/selects.result
+++ b/mysql-test/suite/perfschema/r/selects.result
@@ -84,22 +84,22 @@ id c
13 [EVENT_ID]
DROP TRIGGER t_ps_trigger;
DROP PROCEDURE IF EXISTS t_ps_proc;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
BEGIN
-SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid INTO pid;
+SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid INTO pid;
END;
|
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
DROP FUNCTION IF EXISTS t_ps_proc;
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
BEGIN
-return (SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid);
+return (SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid);
END;
|
-SELECT t_ps_func(0) = @p_id;
-t_ps_func(0) = @p_id
+SELECT t_ps_func(connection_id()) = @p_id;
+t_ps_func(connection_id()) = @p_id
1
SELECT * FROM t_event;
EVENT_ID
diff --git a/mysql-test/suite/perfschema/t/dml_threads.test b/mysql-test/suite/perfschema/t/dml_threads.test
index 6ea456fee69..b6a65b57733 100644
--- a/mysql-test/suite/perfschema/t/dml_threads.test
+++ b/mysql-test/suite/perfschema/t/dml_threads.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
@@ -28,7 +28,7 @@ select * from performance_schema.THREADS
--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.THREADS
- set name='FOO', thread_id=1, id=2;
+ set name='FOO', thread_id=1, processlist_id=2;
--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index 6b6335ac424..dc9a7a09e40 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
##
## WL#4814, 4.1.4 FILE IO
@@ -154,16 +154,16 @@ LIMIT 10;
# Total and average wait time for different users
#
---disable_result_log
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
-# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
-ORDER BY SUM_WAIT DESC
-LIMIT 20;
---enable_result_log
+## --disable_result_log
+## SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+## # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
+## FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
+## INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+## LEFT JOIN information_schema.PROCESSLIST i USING (ID)
+## GROUP BY i.user
+## ORDER BY SUM_WAIT DESC
+## LIMIT 20;
+## --enable_result_log
#
# Total and average wait times for different events for a session
@@ -172,7 +172,7 @@ LIMIT 20;
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
--enable_result_log
@@ -181,12 +181,12 @@ HAVING TOTAL_WAIT > 0;
# Which user reads and writes data
#
---disable_result_log
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
-FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
-HAVING BYTES > 0
-ORDER BY i.user, h.operation;
---enable_result_log
+## --disable_result_log
+## SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+## FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
+## INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+## LEFT JOIN information_schema.PROCESSLIST i USING (ID)
+## GROUP BY i.user, h.operation
+## HAVING BYTES > 0
+## ORDER BY i.user, h.operation;
+## --enable_result_log
diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test
index b673c896024..d0249fe654c 100644
--- a/mysql-test/suite/perfschema/t/selects.test
+++ b/mysql-test/suite/perfschema/t/selects.test
@@ -136,17 +136,17 @@ DROP PROCEDURE IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
BEGIN
- SELECT id FROM performance_schema.THREADS
- WHERE THREAD_ID = tid INTO pid;
+ SELECT thread_id FROM performance_schema.THREADS
+ WHERE PROCESSLIST_ID = conid INTO pid;
END;
|
delimiter ;|
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
# FUNCTION
@@ -155,17 +155,17 @@ DROP FUNCTION IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
BEGIN
- return (SELECT id FROM performance_schema.THREADS
- WHERE THREAD_ID = tid);
+ return (SELECT thread_id FROM performance_schema.THREADS
+ WHERE PROCESSLIST_ID = conid);
END;
|
delimiter ;|
-SELECT t_ps_func(0) = @p_id;
+SELECT t_ps_func(connection_id()) = @p_id;
# We might reach this point too early which means the event scheduler has not
# execute our "t_ps_event". Therefore we poll till the record was inserted
diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test
index 5560f66babb..a59f568e8a2 100644
--- a/mysql-test/suite/perfschema/t/thread_cache.test
+++ b/mysql-test/suite/perfschema/t/thread_cache.test
@@ -31,14 +31,14 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
connection default;
@@ -59,7 +59,7 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
disconnect con3;
disconnect con1;
@@ -83,14 +83,14 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
connection default;
@@ -109,7 +109,7 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
- where ID = connection_id()`;
+ where PROCESSLIST_ID = connection_id()`;
disconnect con3;
disconnect con1;
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 977907c9c14..d5dd20542ff 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -467,8 +467,8 @@ DROP PREPARE stmt;
SET @l1="CREATE TABLE performance_schema.THREADS(";
SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
+SET @l3="PROCESSLIST_ID INTEGER,";
+SET @l4="NAME VARCHAR(128) not null";
SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index bba7806cab9..d9aa600a21e 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -34,13 +34,13 @@ static const TABLE_FIELD_TYPE field_types[]=
{ NULL, 0}
},
{
- { C_STRING_WITH_LEN("ID") },
+ { C_STRING_WITH_LEN("PROCESSLIST_ID") },
{ C_STRING_WITH_LEN("int(11)") },
{ NULL, 0}
},
{
{ C_STRING_WITH_LEN("NAME") },
- { C_STRING_WITH_LEN("varchar(64)") },
+ { C_STRING_WITH_LEN("varchar(128)") },
{ NULL, 0}
}
};
@@ -140,7 +140,7 @@ void table_threads::make_row(PFS_thread *pfs)
}
int table_threads::read_row_values(TABLE *table,
- unsigned char *,
+ unsigned char *buf,
Field **fields,
bool read_all)
{
@@ -150,7 +150,8 @@ int table_threads::read_row_values(TABLE *table,
return HA_ERR_RECORD_DELETED;
/* Set the null bits */
- DBUG_ASSERT(table->s->null_bytes == 0);
+ DBUG_ASSERT(table->s->null_bytes == 1);
+ buf[0]= 0;
for (; (f= *fields) ; fields++)
{
@@ -161,7 +162,7 @@ int table_threads::read_row_values(TABLE *table,
case 0: /* THREAD_ID */
set_field_ulong(f, m_row.m_thread_internal_id);
break;
- case 1: /* ID */
+ case 1: /* PROCESSLIST_ID */
set_field_ulong(f, m_row.m_thread_id);
break;
case 2: /* NAME */
diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h
index 9df323f6d82..fb239007069 100644
--- a/storage/perfschema/table_threads.h
+++ b/storage/perfschema/table_threads.h
@@ -36,7 +36,7 @@ struct row_threads
{
/** Column THREAD_ID. */
ulong m_thread_internal_id;
- /** Column ID. */
+ /** Column PROCESSLIST_ID. */
ulong m_thread_id;
/** Column NAME. */
const char *m_name;
@@ -79,7 +79,7 @@ private:
/** Current row. */
row_threads m_row;
- /** True is the current row exists. */
+ /** True if the current row exists. */
bool m_row_exists;
/** Current position. */
PFS_simple_index m_pos;