facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.47k stars 711 forks source link

Upgrade all system tables(exclude mysql.gtid_executed) from INNODB to MyRocks #1390

Closed luqun closed 3 months ago

luqun commented 7 months ago

Summary:

During mysqld version changes, it call upgrade_system_schemas() to upgrade SYSTEM tables. During DDSE change, It will also call upgrade_system_schemas() to upgrade these SYSTEM tables.

One question is how to "reliability" upgrade SYSTEM tables during DDSE change(upgrade SYSTEM tables occurs after DD_ENGINE properties has been changed to target DDSE):

Details:

The change has several assumptions:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: https://phabricator.intern.facebook.com/D51085626

luqun commented 7 months ago

Can you explain why exactly is the new DD_PROPERTIES entry required? Would the following work without it?

  • Handle DD tables first, as usual
  • Go through all the system tables, if engine != dd engine, do ALTER TABLE

To me this looks crash-safe too, unless I'm missing something.

Yes, it is crash-safe and also quick restart. For quick restart, in order to detect whether we need to run alter tables during restart, either check all SYSTEM tables or add a mark to record state

laurynas-biveinis commented 7 months ago

Yes, it is crash-safe and also quick restart. For quick restart, in order to detect whether we need to run alter tables during restart, either check all SYSTEM tables or add a mark to record state

Checking this property for SYSTEM tables should be cheap (they will be in the DD cache). I am a bit worried that a new DD_PROPERTIES will complicate things (i.e. have to delete it on MyRocks -> InnoDB DDSE change), but if you prefer this approach, it's OK.

luqun commented 7 months ago

(i.e. have to delete it on MyRocks -> InnoDB DDSE change)

I think we can keep these variables even for MyRocks->INNODB DDSE change. I agree that remove these variables will be tricky during that DDSE change.

luqun commented 4 months ago

@laurynas-biveinis , would you take a look again? just rebase with your latest change. also use script to upgrade these system tables.

laurynas-biveinis commented 4 months ago

I believe we have to fully think through user-issued ALTER TABLE mysql.systable ENGINE=anything support.

With your approach, or with previously-suggested my one, or, I believe, with any approach in the server, any ALTER TABLE that changes engine away from the default_dd_system_storage_engine will be either ignored (good for user who issued it but bad for the idea behind this PR), either reverted (good for this PR, bad for the user).

I see two ways out of this:

What do you think?

luqun commented 4 months ago

What do you think?

Discuss offline and we believe we should disable "alter table system tables into non-DDSE" for users to keep simple. All DD Tables and SYSTEMS Tables always use DDSE.

luqun commented 4 months ago

@laurynas-biveinis , now it is ready for review.. :)

luqun commented 4 months ago

Resolved all comments and also add a new variables skip-sys-tables-engine-check, since some MTRs alter system table to myiasm engine.

laurynas-biveinis commented 4 months ago

also add a new variables skip-sys-tables-engine-check, since some MTRs alter system table to myiasm engine.

Since we will never be changing system table engine to MyISAM, can we just disable those testcases instead?

luqun commented 4 months ago

also add a new variables skip-sys-tables-engine-check, since some MTRs alter system table to myiasm engine.

Since we will never be changing system table engine to MyISAM, can we just disable those testcases instead?

Problem is that these testcase also test other scenarios in same time..maybe a new global variable is better..

laurynas-biveinis commented 4 months ago

luqun @.***> writes:

yep. it complains Static_cast from 'legacy_db_type ' to 'uint ' (aka 'unsigned int *') is not allowed.

Right, it's pointers. OK to leave as-is.

laurynas-biveinis commented 4 months ago

luqun @.***> writes:

also add a new variables skip-sys-tables-engine-check, since some MTRs alter system table to myiasm engine.

Since we will never be changing system table engine to MyISAM, can we just disable those testcases instead?

Problem is that these testcase also test other scenarios in same time..maybe a new global variable is better..

Can you list those tests?

If they happen to be debug-only, then we can piggyback on +d,skip_dd_table_access_check. The debug injection name is not a perfect match, but it would suffice IMHO.

luqun commented 4 months ago

Can you list those tests? If they happen to be debug-only, then we can piggyback on +d,skip_dd_table_access_check. The debug injection name is not a perfect match, but it would suffice IMHO. There is only 1 debug only test..

mysql-test/suite/perfschema/t/error_log.test mysql-test/t/system_tables_myisam.test mysql-test/t/system_tables_myisam_lctn_1.test mysql-test/t/transactional_acl_tables.test mysql-test/suite/auth_sec/t/atomic_rename_user.test mysql-test/t/dd_schema_dd_properties_debug.test

laurynas-biveinis commented 4 months ago

mysql-test/suite/perfschema/t/error_log.test mysql-test/t/system_tables_myisam.test mysql-test/t/system_tables_myisam_lctn_1.test mysql-test/t/transactional_acl_tables.test mysql-test/suite/auth_sec/t/atomic_rename_user.test mysql-test/t/dd_schema_dd_properties_debug.test

I see. It would require some effort to split these tests into MyISAM and non-MyISAM parts, feel free to go ahead with the new sysvar or split the tests as you see best

facebook-github-bot commented 4 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

This pull request has been merged in facebook/mysql-5.6@f73d8f48babd49778e588bf88f2e3647c22776d4.