vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.44k stars 2.08k forks source link

Bug Report: `DeleteBeforeRestore` is ignored in backup engines #16811

Open rvrangel opened 2 hours ago

rvrangel commented 2 hours ago

Overview of the Issue

Pulling this discussion out of another PR: Vitess has a flag called DeleteBeforeRestore that is supposed to signal the backup engines if they should wipe out the current MySQL data before restoring a backup, but it is currently being ignored by all backup engines (including the new one introduce in https://github.com/vitessio/vitess/pull/16295)

We decided to keep the behaviour consistent for now, but this issue is to continue the discussion if we should remove this or fix anything that might be breaking as a result of it.

Reproduction Steps

From the description in here, it seems vtop would be relying on the backup engines ignoring that value so that when the vttablet starts with the --restore-from-backup it still deletes and restores the databases despite the vtdataroot already being filled.

Binary Version

current version on (`main`)

Operating System and Environment details

not OS dependant

Log Fragments

No response

rvrangel commented 2 hours ago

when working on https://github.com/vitessio/vitess/pull/16295, we noticed both xtrabackup and builtin ignore that flag and when we used it as expected in mysqlshell, @frouioui saw the issues with the restore failing because the data was still there when the restore started.

For us it wasn't an issue since we either restore on an empty tablet or we call the RestoreFromBackup RPC (which would cause it to be wiped), but it seems that the vtop tooling doesn't clean tablets once they are restored and relies on this "bug" to complete the restore?