Option for disabling fast shutdown during xtrabackup prepare

Hi @Community,

I am looking if there is option to do the slow shutdown of innodb during xtrabackup prepare step.
Currently from xtrabackup --prepare logs, I see that the fast shutdown is performed.

Sample line from the prepare logs:
xtrabackup: starting shutdown with innodb_fast_shutdown = 1

Hello @Rishabh_Gupta,
Can you give us more context here? Why do you want to disable this?

Hi @matthewb,

I am trying to root cause an issue in which secondary index are corrupted on restore.
As we have lot of secondary indexes and frequent updates, we have change buffer enabled.

While restoring I haven’t copied the ib_buffer_pool and undo, redo logs as I am assuming that percona created backups are consistent and doesn’t require crash recovery. So innodb will recreate them on restore.

I noticed that during the prepare step we do the fast shutdown of innodb. So, trying to do the slow shutdown and see if there is still secondary index corruption occurs.

xtrabackup version:
2.4.29

source mysql version:
5.7.44

commands used:
xtrabackup --backup --host=$MYSQL_CONTAINER_IP --user=root --password=$MYSQL_ROOT_PASSWORD --target-dir=/xtrabackup_data

xtrabackup --prepare --target-dir=/xtrabackup_data

PXB does perform crash recovery during the --prepare stage. When this is completed, your backup is now in a consistent state.

If you are having index corruption (extremely rare for innodb), I would check before you take the backup. You can run CHECK TABLE, ANALYZE TABLE, and even OPTIMIZE TABLE (will lock and rebuild the table).

Yeah, I checked the indexes in source server, and they are no corruption found.
The issue is happening in most of the secondary indexes after restoring.

That’s why I am looking for some option to try performing the slow shutdown during prepare step and then see if the issue occurs again.

Is it possible currently in PXB?

After you restore, where do you see corruption? Does mysql crash with errors?

You might try adding this to /etc/my.cnf
[xtrabackup]
innodb_fast_shutdown=0

but I don’t know if that works.

No mysql didnt crash. The server is started but

But when I run the CHECK TABLE command I am getting error. This indicates the secondary index is corrupted after restore.

| testdb12.table3 | check | Warning | InnoDB: Index ‘table3_sec_index_2’ contains 62024789 entries, should be 62026461. |
| testdb12.table3 | check | error | Corrupt

Use innodb_force_recovery https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html in order to make MySQL start up. Then use mysqldump to dump just that table. Drop it. Shut down mysql and remove force_recovery. Start mysql. Import the table.