Bug #87436 error/inplace upgrade to read-only 8.0: Performance schema initialization failed
Submitted: 16 Aug 2017 12:20 Modified: 28 Sep 2017 11:57
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[16 Aug 2017 12:20] Shane Bester
Description:
When performing an inplace upgrade from 5.7 to 8.0.2, with --read-only option enabled as it would be on any slave,  it fails with:

Relevant log file:

 [Note] InnoDB: 8.0.2 started; log sequence number 0
 [Note] InnoDB: Loading buffer pool(s) from E:\mysql-advanced-5.7.19-winx64\data\ib_buffer_pool
 [Note] InnoDB: Buffer pool(s) load completed at 170816 14:10:22
 [Note] Created Data Dictionary for upgrade
 [Note] Finished populating Data Dictionary tables with data.
 [Note] Finished migrating TABLE statistics data.
 [Note] Finished migrating INDEX statistics data.
 [Warning] Skip re-populating collations and character sets tables in read-only mode.
 [Note] Found data dictionary with version 1
 [Warning] Skip updating information_schema metadata in read-only mode.
 [Warning] Skip updating performance_schema metadata in read-only mode.
 [ERROR] Performance schema initialization failed.
 [ERROR] Aborting
 [Note] InnoDB: FTS optimize thread exiting.
 [Note] Binlog end
 [Note] Shutting down plugin 'ngram'
<cut>

workaround1: remove read-only from my.cnf on first startup.
workaround2: rerun mysqld, it seems to startup on second invocation.

How to repeat:
inplace upgrade from 5.7 to 8.0 with --read-only option.

Suggested fix:
o) allow internal data dictionary updating to properly happen even when read-only option is enabled and avoid scary looking messages and failed startups.
 
o) disable the performance_schema so server can continue to startup.
[28 Sep 2017 8:18] Simon Mudd
Also if not done already please version the character set and collation information so that you can check if it's out of date (even with minor versions) and upgrade accordingly.
* This avoids the DBA having to worry about this or handle it manually.
* If you version this information make that visible to the DBA to allow him to verify that the right version is present.
[28 Sep 2017 11:57] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.4, 9.0.0  release, and here's the changelog entry:

During data directory creation or upgrade from MySQL 5.7 to 8.0, server
startup would fail due to a Performance Schema initialization failure if
the server was started in read_only mode. Additionally, Information Schema
metadata was not updated at startup, and Performance Schema and
Information Schema version information was stored without verifying that
schema tables were created. 

The versioning scheme used for the data dictionary and Information 
Schema system views is now consistent with the Performance Schema 
versioning scheme.
[13 Nov 2017 9:24] Manyi Lu
Hi Simon,

  Unicode version number is present in the collation name, 0900 in utf8mb4_0900_ai_ci stands for unicode version 9.0.0.

Manyi