summaryrefslogtreecommitdiff
path: root/mysql-test/suite/perfschema
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-01-15 13:36:32 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-01-15 13:43:05 +0200
commit76b58c2af78cb25212309f5f00554750cbdb5372 (patch)
tree89d9bff835ead9e563bca38cd3a1bd96dbb51baa /mysql-test/suite/perfschema
parentd79141d641a6590c84d9360feaa8714ee0e570fe (diff)
downloadmariadb-git-76b58c2af78cb25212309f5f00554750cbdb5372.tar.gz
MDEV-24600 performance_schema.events_transactions_history_long.trx_id reports garbage
The table performance_schema.events_transactions_history_long that was imported from MySQL 5.7.28 in commit 0ea717f51a152afdb3791195c4a25ee0baa2faac may report bogus trx_id values for InnoDB transactions. innobase_register_trx(): Pass trx->id to trans_register_ha(), even if it is 0. It is more appropriate to report NULL than some arbitrary value that has been constructed from the address of a transaction identifier.
Diffstat (limited to 'mysql-test/suite/perfschema')
-rw-r--r--mysql-test/suite/perfschema/r/innodb_events_transactions_history_long.result16
-rw-r--r--mysql-test/suite/perfschema/t/innodb_events_transactions_history_long.test19
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/r/innodb_events_transactions_history_long.result b/mysql-test/suite/perfschema/r/innodb_events_transactions_history_long.result
new file mode 100644
index 00000000000..1d8c372fa39
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/innodb_events_transactions_history_long.result
@@ -0,0 +1,16 @@
+#
+# MDEV-24600 performance_schema.events_transactions_history_long.trx_id
+# reports garbage
+#
+TRUNCATE performance_schema.events_transactions_history_long;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+COMMIT;
+BEGIN;
+SELECT table_name FROM mysql.innodb_table_stats LIMIT 0 LOCK IN SHARE MODE;
+table_name
+COMMIT;
+SELECT state,trx_id,gtid
+FROM performance_schema.events_transactions_history_long;
+state trx_id gtid
+COMMITTED NULL 0-0-0
+COMMITTED NULL 0-0-0
diff --git a/mysql-test/suite/perfschema/t/innodb_events_transactions_history_long.test b/mysql-test/suite/perfschema/t/innodb_events_transactions_history_long.test
new file mode 100644
index 00000000000..f13bfe87689
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/innodb_events_transactions_history_long.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-24600 performance_schema.events_transactions_history_long.trx_id
+--echo # reports garbage
+--echo #
+
+TRUNCATE performance_schema.events_transactions_history_long;
+
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+COMMIT;
+BEGIN;
+SELECT table_name FROM mysql.innodb_table_stats LIMIT 0 LOCK IN SHARE MODE;
+COMMIT;
+
+SELECT state,trx_id,gtid
+FROM performance_schema.events_transactions_history_long;