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

Snapshot of MariaDB Add-on likely corrupt #1575

Closed
stewartsmith opened this issue Sep 16, 2020 · 14 comments
Closed

Snapshot of MariaDB Add-on likely corrupt #1575

stewartsmith opened this issue Sep 16, 2020 · 14 comments

Comments

@stewartsmith
Copy link

The problem

When creating a Snapshot to download from the HA Web UI, the MariaDB portion is just a copy of the data directory. Seeing as this is not done with mysqldump or 'xtrabackup`, it means that writes may be ongoing as the files are copied, which render the copy corrupt.

i.e. by default, the 'snapshot' cannot be consistent for the MariaDB database.

Environment

Applies to all environments.

  • Add-on with the issue: MariaDB
  • Add-on release with the issue: All
  • Last working add-on release (if known): Never
  • Operating environment (OS/Supervised): All

Problem-relevant configuration

recorder:
  db_url: mysql://homeassistant:XXXXXXX@core-mariadb/homeassistant?charset=utf8
  

Traceback/Error logs

Additional information

The correct behaviour should be that when you create a Snapshot of the MariaDB database, it either uses mysqldump or xtrabackup to create a consistent copy of the data. Anyone currently successfully using the snapshot to restore a MariaDB database is getting a non-corrupt database purely by accident.

@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 25, 2020
@jrial
Copy link

jrial commented Dec 26, 2020

Does this still happen?

@stale stale bot removed the stale label Dec 26, 2020
@oncleben31
Copy link

It happened to me yesterday

@svh1985
Copy link

svh1985 commented Jan 2, 2021

One option would be to quickly stop MariaDB before the backup or restore. I used that trick when a restore did not work due to corrupt data.

@stewartsmith
Copy link
Author

Stopping/Starting MariaDB before/after backup is more of a workaround, and does cause an outage. The mysqldump utility that ships with it can get a logical (SQL) backup that's consistent without a problem and not have downtime.

@oncleben31
Copy link

@stewartsmith Have you an example of implementation of this ?

@stale
Copy link

stale bot commented Mar 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 11, 2021
@jrial
Copy link

jrial commented Mar 11, 2021

Unstale.

@stale stale bot removed the stale label Mar 11, 2021
@stale
Copy link

stale bot commented May 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 12, 2021
@xzwr
Copy link

xzwr commented May 13, 2021

Still not solved.

@stale stale bot removed the stale label May 13, 2021
@Delta1977
Copy link

Still open. At Moment Mariadb-Addon Snapshots / Backup is unusable.
This should be resolved as other Addons like "Home Assistant Community Add-on: Nginx Proxy Manager" depends on mariadb

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 23, 2021
@stewartsmith
Copy link
Author

It doesn't look like anything has changed. The backup tarballs still contain a copy of the MariaDB data directory, and unless there's extra XtraBackup steps being performed behind the scenes, then this is still basically just a corrupt copy of the database as part of the "backup"

@ludeeus
Copy link
Member

ludeeus commented Sep 24, 2021

There is, it was implemented in #2063

@ludeeus ludeeus closed this as completed Sep 24, 2021
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

7 participants