Skip to content

Commit

Permalink
Port Fast Index Creation to 5.6
Browse files Browse the repository at this point in the history
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
Rudradev Basak authored and jtolmer committed Dec 28, 2015
1 parent 6aa6ad5 commit 413b034
Show file tree
Hide file tree
Showing 18 changed files with 1,405 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/client_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ enum options_client
OPT_USE_SEMISYNC,
OPT_SEMISYNC_DEBUG,
OPT_TIMEOUT,
OPT_INNODB_OPTIMIZE_KEYS,
OPT_LRA_SIZE, OPT_LRA_SLEEP, OPT_LRA_N_NODE_RECS_BEFORE_SLEEP,
OPT_MAX_CLIENT_OPTION
};
Expand Down
Loading

0 comments on commit 413b034

Please sign in to comment.