1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

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
This commit is contained in:
Marc Alff
2010-10-06 18:03:27 -06:00
parent f79f6e0c34
commit 4c929d53fa
11 changed files with 70 additions and 84 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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