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

MariaDB import not atomic #15

Open
gregcorbett opened this issue Apr 28, 2022 · 1 comment
Open

MariaDB import not atomic #15

gregcorbett opened this issue Apr 28, 2022 · 1 comment

Comments

@gregcorbett
Copy link
Member

Given the structure of the MariaDB dump file, below, each table in turn is dropped and recreated.

DROP TABLE IF EXISTS `countries`;
CREATE TABLE `countries` (...);
INSERT INTO `countries` VALUES (...);

The import will error out if one of these SQL commands fail.

This would lead to an inconsistent database, with some of the database having been updated (i.e. the commands run before the error) and some of it not having been updated (i.e. commands that didn't run because an earlier command failed). It could also result in a table not exisiting or having no data (i.e. the table whose CREATE or INSERT commands failed).

Ideally, the import would be atomic and either successed at importing all the new data, or roll back to the previous state before the import was attempted.

@tofu-rocketry
Copy link
Member

Do transactions work with drop table?

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