Bug #45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA
Submitted: 26 May 2009 7:43 Modified: 14 Jan 2010 18:06
Reporter: Jørgen Austvik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:6.0.12-alpha-log-perfschema OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[26 May 2009 7:43] Jørgen Austvik
Description:
I am able to create tables with engine PERFORMANCE_SCHEMA. A second strange effect is that I can not DESCRIBE the new tables, even though they show up in "SHOW TABLES". I believe fixing the first issues will make fixing this unnecessary.

I do not think I should be allowed to neither create tables of engine PERFORMANCE_SCHEMA.

-------8<-------------8<-------------8<-------------8<-------------8<------
mysql> CREATE TABLE t2 (id INT) ENGINE='PERFORMANCE_SCHEMA';
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW WARNINGS;
Empty set (0.00 sec)

mysql> show tables;
+----------------------------------------------+
| Tables_in_performance_schema                 |
+----------------------------------------------+
| COND_INSTANCES                               | 
| EVENTS_WAITS_CURRENT                         | 
| EVENTS_WAITS_HISTORY                         | 
| EVENTS_WAITS_HISTORY_LONG                    | 
| EVENTS_WAITS_SUMMARY_BY_EVENT_NAME           | 
| EVENTS_WAITS_SUMMARY_BY_INSTANCE             | 
| EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME | 
| FILE_INSTANCES                               | 
| FILE_SUMMARY_BY_EVENT_NAME                   | 
| FILE_SUMMARY_BY_INSTANCE                     | 
| MUTEX_INSTANCES                              | 
| PERFORMANCE_TIMERS                           | 
| PROCESSLIST                                  | 
| RWLOCK_INSTANCES                             | 
| SETUP_CONSUMERS                              | 
| SETUP_INSTRUMENTS                            | 
| SETUP_OBJECTS                                | 
| SETUP_TIMERS                                 | 
| t1                                           | 
| t2                                           | 
+----------------------------------------------+
20 rows in set (0.00 sec)

mysql> DESCRIBE t1;
ERROR 1146 (42S02): Table 'performance_schema.t1' doesn't exist
mysql> DESCRIBE t2;
ERROR 1146 (42S02): Table 'performance_schema.t2' doesn't exist
mysql> DROP TABLE t1;
Query OK, 0 rows affected (0.04 sec)

mysql> DROP TABLE t2;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW TABLES;
+----------------------------------------------+
| Tables_in_performance_schema                 |
+----------------------------------------------+
| COND_INSTANCES                               | 
| EVENTS_WAITS_CURRENT                         | 
| EVENTS_WAITS_HISTORY                         | 
| EVENTS_WAITS_HISTORY_LONG                    | 
| EVENTS_WAITS_SUMMARY_BY_EVENT_NAME           | 
| EVENTS_WAITS_SUMMARY_BY_INSTANCE             | 
| EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME | 
| FILE_INSTANCES                               | 
| FILE_SUMMARY_BY_EVENT_NAME                   | 
| FILE_SUMMARY_BY_INSTANCE                     | 
| MUTEX_INSTANCES                              | 
| PERFORMANCE_TIMERS                           | 
| PROCESSLIST                                  | 
| RWLOCK_INSTANCES                             | 
| SETUP_CONSUMERS                              | 
| SETUP_INSTRUMENTS                            | 
| SETUP_OBJECTS                                | 
| SETUP_TIMERS                                 | 
+----------------------------------------------+
18 rows in set (0.00 sec)
-------8<-------------8<-------------8<-------------8<-------------8<------

How to repeat:
CREATE TABLE t1 (id INT) ENGINE='PERFORMANCE_SCHEMA';

Suggested fix:
Make it impossible to create tables with engine type PERFORMANCE_SCHEMA;
[26 May 2009 8:48] Sveta Smirnova
Thank you for the report.

Verified as described.
[3 Jun 2009 18:19] Marc ALFF
Fixed with:
bzr commit into mysql-6.0-perfschema branch (marc.alff:3158)
[26 Jun 2009 9:12] Guilhem Bichot
runtime team will be better-suited for reviewing this.
[4 Nov 2009 1:25] Marc ALFF
The fix for this bug is implemented in ha_perfschema::create(),
which checks the table fully qualified name,
and does not rely on privileges in sql_acl.cc

Tests have been added in misc.test (in mysql-trunk-perfschema)

Re-assigning guilhem as reviewer.
[4 Nov 2009 18:23] Marc ALFF
The fix is queued in mysql-trunk-perfschema
[14 Jan 2010 10:03] Marc ALFF
Merged in:
- mysql-next-mr (Celosia / 5.5.99-m3)
- mysql-6.0-codebase (6.0.14)
[14 Jan 2010 18:06] Paul DuBois
Not in any released version. No changelog entry needed.