Commit be7a6d93 authored by Marc Alff's avatar Marc Alff

Improved the test performance_schema.func_file_io,

so that investigating test failures is easier.

Detect cases when @before_count / @after_count is NULL.
parent 8aedf7d3
...@@ -15,6 +15,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT) ...@@ -15,6 +15,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD')); AND (OBJECT_NAME LIKE '%t1.MYD'));
SELECT (@before_count >= 0) as have_before_count;
have_before_count
1
SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
has_instrumentation has_instrumentation
Success Success
...@@ -27,6 +30,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT) ...@@ -27,6 +30,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
SELECT (@after_count >= 0) as have_after_count;
have_after_count
1
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
test_ff1_timed test_ff1_timed
Success Success
...@@ -35,6 +41,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT) ...@@ -35,6 +41,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
SELECT (@before_count >= 0) as have_before_count;
have_before_count
1
SELECT * FROM t1 WHERE id < 6; SELECT * FROM t1 WHERE id < 6;
id b id b
1 initial value 1 initial value
...@@ -46,6 +55,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT) ...@@ -46,6 +55,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
SELECT (@after_count >= 0) as have_after_count;
have_after_count
1
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed;
test_ff2_timed test_ff2_timed
Success Success
......
...@@ -41,6 +41,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT) ...@@ -41,6 +41,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD')); AND (OBJECT_NAME LIKE '%t1.MYD'));
SELECT (@before_count >= 0) as have_before_count;
SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
SELECT * FROM t1 WHERE id < 4; SELECT * FROM t1 WHERE id < 4;
...@@ -50,6 +51,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT) ...@@ -50,6 +51,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
SELECT (@after_count >= 0) as have_after_count;
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
UPDATE performance_schema.setup_instruments SET enabled='NO'; UPDATE performance_schema.setup_instruments SET enabled='NO';
...@@ -59,6 +61,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT) ...@@ -59,6 +61,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
SELECT (@before_count >= 0) as have_before_count;
SELECT * FROM t1 WHERE id < 6; SELECT * FROM t1 WHERE id < 6;
SET @after_count = (SELECT SUM(TIMER_WAIT) SET @after_count = (SELECT SUM(TIMER_WAIT)
...@@ -66,6 +69,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT) ...@@ -66,6 +69,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
SELECT (@after_count >= 0) as have_after_count;
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed;
# #
......
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