MDEV-34817: Performance schema is not cleared of removed package routines#4941
MDEV-34817: Performance schema is not cleared of removed package routines#4941kjarir wants to merge 1 commit intoMariaDB:10.11from
Conversation
f8f310c to
4b18863
Compare
a85b8f2 to
840d71d
Compare
There was a problem hiding this comment.
As 10.11 is affected too, sorry it wasn't obvious on the bug, back port this to there. Note a few variable constructs are different, but the compiler will find them.
There's a test case for DROP DATABASE, but as your implementation highlights, DROP PACKAGE/ DROP PACKAGE BODY are also affected. Just testing one of these is sufficient as both end up in sp_drop_routine_internal.
Lastly, the improved commit message header is better than the previous MDEV title. But I think the title I rename this PR is clearer again so please use that. There should be a body in the commit message describing the problem and correction.
|
Thanks for the detailed review @grooverdan. Working through all the points now, will push an updated version shortly with the static helper, improved test formatting, DROP PACKAGE test case, and updated commit message. |
140e66f to
a2fa6a1
Compare
|
|
a2fa6a1 to
4678182
Compare
…ines The Performance Schema table events_statements_summary_by_program was retaining stale rows for package sub-routines after the parent package or database was dropped. This caused regression tests like perfschema.lowercase_fs_off to fail non-deterministically due to unexpected ghost rows in the summary table. The fix ensures that during DROP DATABASE and DROP PACKAGE BODY operations, all associated package routines are properly identified and removed from the Performance Schema instrumentation by abstracting the PSI cleanup logic into a static helper function and invoking it from both sp_drop_routine_internal and sp_drop_db_routines.
4678182 to
d43140a
Compare
grooverdan
left a comment
There was a problem hiding this comment.
Its currently failing on embedded tests.
--- /home/buildbot/amd64-debian-11-debug-ps-embedded/build/mysql-test/suite/compat/oracle/r/perfschema.result 2026-04-16 06:40:34.000000000 +0000
+++ /home/buildbot/amd64-debian-11-debug-ps-embedded/build/mysql-test/suite/compat/oracle/r/perfschema.reject 2026-04-16 06:45:26.326364209 +0000
@@ -40,7 +40,6 @@
FROM performance_schema.events_statements_summary_by_program
WHERE LOWER(object_schema)='mdev34817_db';
object_type object_schema object_name
- mdev34817_db pkg1
DROP DATABASE mdev34817_db;
I suspect that a --source include/not_embedded.inc might be needed as many of mysql-test/suite/compat/oracle/t around stored procedures already do. I'm going to leave this as a call to the second reviewer so no need to address this immediately.
Problem
When DROP DATABASE or DROP PACKAGE BODY is executed, sp_drop_db_routines() was not calling MYSQL_DROP_SP for Oracle-style package body sub-routines. This caused stale ghost rows to remain in events_statements_summary_by_program, making the MTR test perfschema.lowercase_fs_off fail non-deterministically when run after compat/oracle.sp-package.
Fix
Testing
References
Closes MDEV-34817
Closes MDEV-35282