Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Port Percona's patch for fast index creation and a few bug fixes. Adds the --innodb-optimize-keys option to mysqldump: On using this, secondary keys are not created/skipped during table creation, and they are added to the table at the end via an alter statement, after all data has been inserted. This can potentially make the restore from a mysqldump quicker, because it is faster to create a key at the end, rather than handling secondary keys on every insert. This can also slightly reduce the disk space used, because there will be less fragmentation in the secondary key trees. Adds the --expand_fast_index_creation to mysql: Which does the same thing as above (skipping secondary keys, and adding them later) on any alter table statement that requires a copy of the entire data. If expand_fast_index_creation is on and a secondary index in the altered table references the last field in the table an assertion was being triggered. This was related to MySQL sometimes storing field numbers in the key information as zero based values (0 to N-1) and sometimes as one based values (1 to N). One of the functions being called by the code that was added for expand_fast_index_creation was mistakenly passing one-based values to a function that was expecting zero-based values. Test Plan: mtr Relevant tests added. Dumped and restored an udb database using --innodb-optimize-keys. Checked that both the schema of the ~450 tables and the data were unchanged. Did perf test, by checking the restore time (and disk space) for a 50G database. Reviewers: mcallaghan, steaphan Reviewed By: steaphan Differential Revision: https://reviews.facebook.net/D50715
- Loading branch information