List:Commits« Previous MessageNext Message »
From:Marc Alff Date:October 7 2010 12:03am
Subject:bzr commit into mysql-5.5-bugteam branch (marc.alff:3096) Bug#57154
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-5.5-bugteam-57154/ based on revid:alexander.nozdrin@stripped

 3096 Marc Alff	2010-10-06
      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

    modified:
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/selects.result
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/thread_cache.test
      scripts/mysql_system_tables.sql
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
=== modified file 'mysql-test/suite/perfschema/include/setup_helper.inc'
--- a/mysql-test/suite/perfschema/include/setup_helper.inc	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc	2010-10-07 00:03:27 +0000
@@ -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_CONSUMER
 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;
 

=== modified file 'mysql-test/suite/perfschema/r/dml_threads.result'
--- a/mysql-test/suite/perfschema/r/dml_threads.result	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/r/dml_threads.result	2010-10-07 00:03:27 +0000
@@ -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;

=== modified file 'mysql-test/suite/perfschema/r/func_file_io.result'
--- a/mysql-test/suite/perfschema/r/func_file_io.result	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/r/func_file_io.result	2010-10-07 00:03:27 +0000
@@ -94,24 +94,9 @@ FROM performance_schema.EVENTS_WAITS_SUM
 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;

=== modified file 'mysql-test/suite/perfschema/r/selects.result'
--- a/mysql-test/suite/perfschema/r/selects.result	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/r/selects.result	2010-10-07 00:03:27 +0000
@@ -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

=== modified file 'mysql-test/suite/perfschema/t/dml_threads.test'
--- a/mysql-test/suite/perfschema/t/dml_threads.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/dml_threads.test	2010-10-07 00:03:27 +0000
@@ -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

=== modified file 'mysql-test/suite/perfschema/t/func_file_io.test'
--- a/mysql-test/suite/perfschema/t/func_file_io.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/func_file_io.test	2010-10-07 00:03:27 +0000
@@ -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

=== modified file 'mysql-test/suite/perfschema/t/selects.test'
--- a/mysql-test/suite/perfschema/t/selects.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/selects.test	2010-10-07 00:03:27 +0000
@@ -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

=== modified file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test	2010-10-07 00:03:27 +0000
@@ -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;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2010-09-20 14:17:32 +0000
+++ b/scripts/mysql_system_tables.sql	2010-10-07 00:03:27 +0000
@@ -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);

=== modified file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/table_threads.cc	2010-10-07 00:03:27 +0000
@@ -34,13 +34,13 @@ static const TABLE_FIELD_TYPE field_type
     { 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 
 }
 
 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
     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
       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 */

=== modified file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/table_threads.h	2010-10-07 00:03:27 +0000
@@ -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;


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20101007000327-nrt7ybmd85adzhmi.bundle
Thread
bzr commit into mysql-5.5-bugteam branch (marc.alff:3096) Bug#57154Marc Alff7 Oct