summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/perfschema/t/myisam_file_io.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/perfschema/t/myisam_file_io.test
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/perfschema/t/myisam_file_io.test')
-rw-r--r--mysql-test/suite/perfschema/t/myisam_file_io.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test
new file mode 100644
index 00000000..96f24d8a
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/myisam_file_io.test
@@ -0,0 +1,61 @@
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Setup
+
+update performance_schema.setup_instruments set enabled='NO';
+update performance_schema.setup_instruments set enabled='YES'
+ where name like "wait/io/file/myisam/%";
+
+update performance_schema.setup_consumers
+ set enabled='YES';
+
+truncate table performance_schema.events_waits_history_long;
+
+# Reset lost counters to a known state
+truncate table performance_schema.events_statements_summary_by_digest;
+flush status;
+
+# Code to test
+
+--disable_warnings
+drop table if exists test.no_index_tab;
+--enable_warnings
+
+create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+
+# Verification
+# Note that mi_create.c contains mysql_file_tell() calls in debug only,
+# so the result are filtered to remove 'tell'.
+# Note that even after setting other instruments to enabled='NO'
+# and truncating the events_waits_history_long table,
+# some events -- that were already started but not completed --
+# for other instruments could still be added in the history.
+# To protect against that, an extra where clause
+# "and event_name like "wait/io/file/myisam/%"
+# is added to the select to filter out the result.
+
+select event_name,
+ left(source, locate(":", source)) as short_source,
+ operation, number_of_bytes,
+ substring(object_name, locate("no_index_tab", object_name)) as short_name
+ from performance_schema.events_waits_history_long
+ where operation not like "tell"
+ and event_name like "wait/io/file/myisam/%"
+ having short_name <> ""
+ order by thread_id, event_id;
+
+# In case of failures, this will tell if file io are lost.
+show global status like 'performance_schema_%';
+
+# Cleanup
+
+update performance_schema.setup_instruments set enabled='YES';
+
+drop table test.no_index_tab;
+