a question about compact backup in Xbackup

Asked by snowave

i used this new feature ,but i found a question , if i dont use –rebuild-index option, as i think, it only apply data to datafile , the space of secondary index won’t be allocted, so the dadafile files could be used . Actually, when i dont use rebulid option, Xbackup also add some vacnt pages to the exist space file , this monment ,the space file was useless。

should it be as i think, if dont use index rebuild, the space only contain primary key could be used correctly?

Question information

English Edit question
Percona XtraBackup moved to https://jira.percona.com/projects/PXB Edit question
No assignee Edit question
Solved by:
Alexey Kopytov
Last query:
Last reply:
Revision history for this message
Alexey Kopytov (akopytov) said :

Using --rebuild-indexes for compact backups is a must. Without it, InnoDB will crash when trying to access missing secondary index pages.

Revision history for this message
snowave (shawn001) said :

we need a compact backup ,because it can reduce some disk space ,but when some cases we need restore the database as qulickly as possiable, at this point , the rebulid process will need some time. can we prepare data with primary key only ? when mysqld start ,we can create secondary index which is high priority?

In addition,why xtrabackup konws how many pages are allocting for secondary indexes, as show table status like 'aa'\G?

Thank you!

Revision history for this message
Best Alexey Kopytov (akopytov) said :

No, it is impossible to prepare data with primary key only, because then there will be an inconsistency between FRM files (i.e. what the server knows about secondary indexes) and InnoDB data dictionary (i.e. what InnoDB knows about secondary indexes).

XtraBackup knows how many pages are allocated for secondary indexes, because it scans datafiles on backup, and skips secondary index pages.

Revision history for this message
snowave (shawn001) said :

Thanks Alexey Kopytov, that solved my question.