Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate new dump can be restored before trying #14

Open
gregcorbett opened this issue Apr 28, 2022 · 3 comments
Open

Validate new dump can be restored before trying #14

gregcorbett opened this issue Apr 28, 2022 · 3 comments

Comments

@gregcorbett
Copy link
Member

Before the failover pipeline can restore the database from the dump file, it has to drop the existing data.

  • For ORACLE, this happens all at once in dropGocdbUser2.sh
  • For MariaDB, this happens table by table i.e.:
DROP TABLE IF EXISTS `countries`;
CREATE TABLE `countries` (...);
INSERT INTO `countries` VALUES (...);

This leads to problems (atleast under ORACLE) where if the dump can't be restored, the existing data gets dumped anyway.

I can imagine a similar problem under MariaDB, where by a CREATE TABLE command could fail, which would mean the database would be missing a table and its data.

Before trying to restore the dump to the live database, the failover scripts should try and restore the dump to some dummy dataabse and if (and only if) that's successful, then restore the dump to the live database.

@gregcorbett
Copy link
Member Author

gregcorbett commented Apr 28, 2022

In the MariaDB case, making the import atomic feels like it would be sufficent.

@tofu-rocketry
Copy link
Member

tofu-rocketry commented Apr 29, 2022

But also, keep the last known good dump for recovery purposes.

@gregcorbett
Copy link
Member Author

I think that behaviour was originally intended - but the ORACLE version may have decayed.

I believe the MariaDB version will only replace the archived dump if importing the new dump doesn't cause an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants