summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-12-22 16:42:33 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-12-22 16:42:33 +0300
commited5d675c75011603ee04f154fd4162ba1f0b630b (patch)
treed19bf84ba16bdcfcb24cf43439253c0c263e28ed
parent113f18686d004788f13e3a5bb60ea1c77847c963 (diff)
downloadmariadb-git-ed5d675c75011603ee04f154fd4162ba1f0b630b.tar.gz
MDEV-24364 Alter rename table does not remove PFS share
Add missed PSI_CALL_drop_table_share().
-rw-r--r--mysql-test/suite/perfschema/r/misc.result10
-rw-r--r--mysql-test/suite/perfschema/t/misc.test11
-rw-r--r--sql/sql_table.cc2
3 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index b859715e024..83ca6d5cf3f 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -164,3 +164,13 @@ Warnings:
Note 1051 Unknown table 'test.t0'
FLUSH TABLE t0;
DROP TABLE t0;
+#
+# MDEV-24364 Alter rename table does not remove PFS share
+#
+create or replace table yt4 (x int) engine innodb;
+alter table yt4 rename to t1, algorithm=copy;
+drop tables t1;
+select object_type, object_schema, object_name
+from performance_schema.objects_summary_global_by_type
+where object_schema="test";
+object_type object_schema object_name
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index 38972f42cef..848be3beea1 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -287,3 +287,14 @@ enable_query_log;
# an unexpected refcount.
FLUSH TABLE t0;
DROP TABLE t0;
+
+--echo #
+--echo # MDEV-24364 Alter rename table does not remove PFS share
+--echo #
+create or replace table yt4 (x int) engine innodb;
+alter table yt4 rename to t1, algorithm=copy;
+drop tables t1;
+
+select object_type, object_schema, object_name
+from performance_schema.objects_summary_global_by_type
+where object_schema="test";
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 318c01bb1dc..4e1ff93c576 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10956,6 +10956,8 @@ do_continue:;
{
/* The original table is the backup */
backup_name= alter_ctx.table_name;
+ PSI_CALL_drop_table_share(0, alter_ctx.db.str, (int) alter_ctx.db.length,
+ alter_ctx.table_name.str, (int) alter_ctx.table_name.length);
}
// Rename the new table to the correct name.