Generate table defintion on xtrabackup export

Description

To restore a single table from xtrabackup to a running server, the current process is

  1. Download the backup

  2. Decompress if necessary

  3.  prepare the backup with -export option (-prepare --export)

    1. this step creates a .cfg file for every .ibd file

  4. User has to remember the schema of the table being exported at the time of backup (After this improvment PXB-3153, user will no longer need to)

  5. create table with the schema he remembers on the running server

  6. discard tablespace (ALTER TABLE t1 DISCARD TABLESPACE)

  7. copy the t1.ibd and t1.cfg from backup dir to the db directory

  8. ALTER TABLE t1 IMPORT TABLESPACE

 

These steps are error-prone and tedious. Imagine a user who wants to import all tables in a specific directory. We want to automate this entire process from xtrabackup () but as part of this work, we will do the most important task required to solve the problem. " How do you get the schema of the table?"

Proposal

Extend the export option during prepare to generate the schema of the table. ie with xtrabackup --prepare --export, generate .sql file for each tablesapce file (IBD file)

 

Interfaces

  1.  No new option introduced. Existing option --export will generate the tablename.sql file

 

How?

  1. During the prepare phase, xtrabackup deserializes the SDI from IBD

  2. from the SDI, xtrabckup prepares the dd::Table object

  3. Using the dd::Table object, xtrabackup will create the schema of the table

  4. store the schema in the tablename.sql file

  5.  Users who wishes to restore the table will follow the above steps (from step 5)

 

Environment

None

Attachments

1

Activity

Details

Assignee

Reporter

Needs QA

Priority

Created September 20, 2023 at 6:48 PM
Updated November 1, 2024 at 11:56 AM