Bug #98545 Perfschema tables are not collation aware
Submitted: 10 Feb 2020 23:45 Modified: 2 May 2022 7:22
Reporter: Manuel Ung Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[10 Feb 2020 23:45] Manuel Ung
Description:
Performance schema tables are not collation aware, which can lead to multiple issues (eg. "duplicate" entries, leaking entries, etc.)

In this example, an entry is leaked because the CREATE and the DELETE both specify the name in different representations:

CREATE TRIGGER cafe BEFORE INSERT ON t1 FOR EACH ROW SET @sum= @sum + NEW.f1;
DROP TRIGGER CaFĂ©;

The second DROP TRIGGER will call drop_program, which will call lf_hash_delete. However, lf_hash_delete will fail to delete anything, since the entry uses the original string 'cafe' from the CREATE statement, so we end up leaking the entry.

How to repeat:
./mtr --no-reorder main.trigger perfschema.misc

Suggested fix:
This one is tough to fix, but some suggestions anyway:

1. Have multiple hash maps per collation
2. Instead of using string directly as key, use some kind of id instead
[11 Feb 2020 4:53] MySQL Verification Team
Hello Manuel Ung,

Thank you for the bug report and feedback.

regards,
Umesh
[2 May 2022 7:22] MySQL Verification Team
This is fixed in 8.0.29 -

As of this release, the Performance Schema is collation-aware (Bug #98545, Bug #30881109)

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-29.html