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 does not recover from HASS.io backup #1353

Closed
Spirituss opened this issue May 25, 2020 · 48 comments · Fixed by #2063 or home-assistant/supervisor#2941
Closed

MariaDB does not recover from HASS.io backup #1353

Spirituss opened this issue May 25, 2020 · 48 comments · Fixed by #2063 or home-assistant/supervisor#2941

Comments

@Spirituss
Copy link

Home Assistant release with the issue:

Home Assistant 0.110.2

Last working Home Assistant release (if known):
Unknown (but it definitely worked earlier).

Operating environment (Hass.io/Docker/Windows/etc.):

Hass.io/Docker/Supervised

Component/platform:

MariaDB add-on used as record/history component.

Description of problem:
After recovery from Hass.io snapshot MariaDB doesn't work any more. The only way to force it to work is to uninstall the add-on and install it again with the same settings. Of course, in this case you lose your DB and history.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

recorder: 
  db_url: mysql://hass:password@192.168.xxx.xxx/homeassistant?charset=utf8
  purge_interval: 7
  purge_keep_days: 7

Traceback (if applicable):

Additional information:
It worked fine on one of earlier version of hass.io. There are other issues containing relevant information that were closed without a solution:
home-assistant/core#26152
#667

@frenck
Copy link
Member

frenck commented May 25, 2020

Anything in the logs?

@Spirituss
Copy link
Author

Spirituss commented May 25, 2020

Anything in the logs?

Different cases on log messages are inside #667 . I had similar one:

(MySQLdb._exceptions.OperationalError) (2002, "Can't connect to MySQL server on 'core-mariadb' (115)")

.
So the only working solution was to remove MariaDB addon and install it again in order it to re-create DB loosing all previous history.

@frenck
Copy link
Member

frenck commented May 25, 2020

A lot has changed in the meantime, I would really need recent add-on logs in order to get clue on where to start.

@agners
Copy link
Member

agners commented May 25, 2020

I mentioned it in the other thread, taking a snapshot from a database while the service is running just like that is not a proper backup operation.

Either the service must be shut down during snapshoting, or the steps documented in the "Filesystem Snapshots" need to be followed: https://mariadb.com/kb/en/backup-and-restore-overview/#filesystem-snapshots. Everything else is a hackaround.

@frenck
Copy link
Member

frenck commented May 25, 2020

That is correct, unfortunately, the add-on is not aware of such a thing, and cannot handle it as suggested.

@michaelarz
Copy link

Restore log, if it helps: Can't restore origin data: [('/data/tmp/tmpken481ki/data/databases/mariadb.err', '/data/addons/data/core_mariadb/databases/mariadb.err', '/data/tmp/tmpken481ki/data/databases/mariadb.err is a named pipe')]

@tungmeister
Copy link

That's the error I get when ever attempting a restore

@agners
Copy link
Member

agners commented May 25, 2020

@frenck I guess it needs an additional hook or something from the add on system would be needed. E.g. a command which would be executed in the container context before/(and after) doing the backup. Then the FLUSH TABLES WITH READ LOCK command could be specified for the MariaDB add-on.

@fedebruni84
Copy link

I have the same problem and the same logs:

20-05-27 07:57:22 INFO (MainThread) [supervisor.addons.addon] Restore data for addon core_mariadb
20-05-27 08:02:07 ERROR (MainThread) [supervisor.addons.addon] Can't restore origin data: [('/data/tmp/tmpxaitwgcr/data/databases/mariadb.err', '/data/addons/data/core_mariadb/databases/mariadb.err', '`/data/tmp/tmpxaitwgcr/data/databases/mariadb.err` is a named pipe')]
20-05-27 08:02:07 ERROR (MainThread) [supervisor.snapshots.snapshot] Can't restore snapshot for core_mariadb
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[10:35:32] INFO: Using existing mariadb initial system
[10:35:32] INFO: Starting MariaDB
200527 10:35:32 mysqld_safe Logging to '/data/databases/mariadb.err'.
200527 10:35:32 mysqld_safe Starting mysqld daemon with databases from /data/databases
2020-05-27 10:35:33 0 [Note] mysqld: Aria engine: starting recovery
recovered pages: 0% 32% 51% 80% 100% (0.0 seconds); tables to flush: 2 1 0
 (0.0 seconds); 
2020-05-27 10:35:33 0 [Note] mysqld: Aria engine: recovery done
2020-05-27 10:35:33 0 [Note] InnoDB: Using Linux native AIO
2020-05-27 10:35:33 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-05-27 10:35:33 0 [Note] InnoDB: Uses event mutexes
2020-05-27 10:35:33 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-05-27 10:35:33 0 [Note] InnoDB: Number of pools: 1
2020-05-27 10:35:33 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-05-27 10:35:33 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2020-05-27 10:35:33 0 [Note] InnoDB: Initializing buffer pool, total size = 64M, instances = 1, chunk size = 64M
2020-05-27 10:35:33 0 [Note] InnoDB: Completed initialization of buffer pool
2020-05-27 10:35:33 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-05-27 10:35:33 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=3766893186
2020-05-27 10:35:34 0 [Note] InnoDB: Recovered page [page id: space=24, page number=162041] from the doublewrite buffer.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Page [page id: space=0, page number=4] log sequence number 3766909838 is in the future! Current system log sequence number 3766904686.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Page [page id: space=0, page number=289] log sequence number 3766909662 is in the future! Current system log sequence number 3766904686.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Page [page id: space=0, page number=505] log sequence number 3766909662 is in the future! Current system log sequence number 3766904686.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Page [page id: space=0, page number=475] log sequence number 3766916180 is in the future! Current system log sequence number 3766904686.
2020-05-27 10:35:34 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-05-27 10:35:34 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 7 row operations to undo
2020-05-27 10:35:34 0 [Note] InnoDB: Trx id counter is 789813
2020-05-27 10:35:34 0 [Note] InnoDB: Starting final batch to recover 35 pages from redo log.
2020-05-27 10:35:34 0x7fc9c6b5bb20  InnoDB: Assertion failure in file /home/buildozer/aports/main/mariadb/src/mariadb-10.4.12/storage/innobase/log/log0recv.cc line 1528
InnoDB: Failing assertion: !page || (ibool)!!page_is_comp(page) == dict_table_is_comp(index->table)
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
InnoDB: about forcing recovery.
200527 10:35:34 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

Server version: 10.4.12-MariaDB
key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=0
max_threads=66
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68678 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x6, backtrace may not be correct.
Bogus stack limit or frame pointer, fp=0x6, stack_bottom=0x7fc9c6b60000, thread_stack=196608, aborting backtrace.
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /data/databases
Resource Limits:
Fatal signal 11 while backtracing

Is there a way to do the backup of the database only using something like mariabackup?

@alexdepalex
Copy link

Same here. I just restored yesterday's snapshot because of issues with deconz, but MySQL is a mess right now. Exactly the same issues as in the log snippet above.

@vistalba
Copy link

vistalba commented Jun 9, 2020

Same issue here. Restored today on new hardware. No luck.
I'm now looking for a automated solution to backup HA with MariaDB.

@basnijholt
Copy link

@frenck, would a backup work if one first shuts down the add-on before making a snapshot?

@vistalba
Copy link

@basnijholt For me it is working if the add-on is stopped before backup and restarted after that.

@Spirituss
Copy link
Author

Anything in the logs?

Hi Frenck,
Today I restored from backup on Hassio 0.110.5. MariaDB add-on failed to restore from the backup as well as the recorder DB, of course. Supervisor lost MariaDB add-on after recovery, it looked like this add-on had never been installed in the system.
Here is the log of Supervisor during recovery process:

20-06-10 16:41:05 INFO (MainThread) [supervisor.addons.addon] Restore config for addon core_mariadb
20-06-10 16:41:05 INFO (MainThread) [supervisor.addons.addon] Restore/Install image for addon core_mariadb
20-06-10 16:41:05 INFO (SyncWorker_1) [supervisor.docker.interface] Pull image homeassistant/armv7-addon-mariadb tag 2.1.2.
20-06-10 16:41:44 INFO (MainThread) [supervisor.addons.addon] Restore data for addon core_mariadb
20-06-10 16:48:51 ERROR (MainThread) [supervisor.addons.addon] Can't restore origin data: [('/data/tmp/tmpeglbfm0q/data/databases/mariadb.err', '/data/addons/data/core_mariadb/databases/mariadb.err', '`/data/tmp/tmpeglbfm0q/data/databases/mariadb.err` is a named pipe')]
20-06-10 16:48:52 ERROR (MainThread) [supervisor.snapshots.snapshot] Can't restore snapshot for core_mariadb

Hope, it will help to solve the issue.

@stale
Copy link

stale bot commented Jul 11, 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 Jul 11, 2020
@vistalba
Copy link

Don‘t close as it isn‘t solved.

@stale stale bot removed the stale label Jul 11, 2020
@agners
Copy link
Member

agners commented Jul 17, 2020

What I currently use is the table lock approach suggested by the MariaDB documentation. Basically, SSH into the underlaying OS, and do the following:

$ docker exec addon_core_mariadb
bash-5.0# mysql
...
MariaDB [(none)]> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.024 sec)

MariaDB [(none)]> 

Leave the shell/mysql client open, and do the backup, then, after the backup finishes:

MariaDB [(none)]> UNLOCK TABLES;

It seems that with this method, I did not even lose an event! The database inserts got queued, and executed after I ran UNLOCK TABLES;. There is quite a big difference in creation date, as the later event got stored only after the backup.

This snapshot of the events table is reverse sorted, so the first row is the newer row... One can see that the backup took 27 minutes (actually, it was faster, I just unlocked the table only after 27 minutes). At 2020-07-17 21:38:19 loooots of events got stored at once:

event_id | event_type    | event_data                                            | origin | time_fired          | created             | context_id      | context_user_id
32856177 | state_changed | {"entity_id": "sensor.openwrt_ethernet_out", "old_... | LOCAL  | 2020-07-17 21:11:11 | 2020-07-17 21:38:19 | be274bba62de484192cc0dc94deae128 | NULL
32856176 | state_changed | {"entity_id": "sensor.openwrt_ethernet_in", "old_s... | LOCAL  | 2020-07-17 21:11:11 | 2020-07-17 21:11:11 | 4bb84f20864649f1a04e5af947ed9a9e | NULL

I think having the Supervisor executing this commands before/after taking the snapshot of the database would be the ideal solution.

@vistalba
Copy link

Thanks @agners for this idea. I think this should work fine.

Supervisor should care about that. So if a snapshot gets triggered and MaraDB is configured then it should execute this commands before/after snapshot.

Any ideas how to achieve this?

@vistalba
Copy link

You can also use following commands to run it directly:

docker exec -i addon_core_mariadb mysql <<< "FLUSH TABLES WITH READ LOCK;"

Take snapshot and wait until finished.

docker exec -i addon_core_mariadb mysql <<< "UNLOCK TABLES;"

You can also exec any DB command you like with:
docker exec -i addon_core_mariadb mysql <<< "use homeassistant; select * from states limit 1;"

@agners
Copy link
Member

agners commented Jul 19, 2020

@vistalba careful, the documentation states explicitly that the client must remain open: https://mariadb.com/kb/en/backup-and-restore-overview/#filesystem-snapshots.

From what I understand, using docker exec as you suggest it will make the mysql process exit after FLUSH TABLES WITH READ LOCK;. This will release the table lock, which is not what we want...

@vistalba
Copy link

You're right :( my bad.

@mantaalex
Copy link

i hope this issue gets a fix ;)

@stale
Copy link

stale bot commented Sep 11, 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 Sep 11, 2020
@jhuang0
Copy link

jhuang0 commented Sep 11, 2020

This is still an issue for me. Would be great if we could get some kind of fix for this...

@stale stale bot removed the stale label Sep 11, 2020
@stale stale bot removed the stale label Dec 25, 2020
@oncleben31
Copy link

Side effect the add on bookstack can't be restored as it uses by default the marinade addon

@jhampson-dbre
Copy link

At a high level, a potential fix could look like:

  1. Snapshot is initiated
  2. Snapshot detects mariadb add-on
  3. Snapshot executes commands to make a recoverable mariadb backup
mariabackup --backup \
   --target-dir=/var/mariadb/backup/ \
   --user=homeassistant --password=mypassword

mariabackup --prepare \
   --target-dir=/var/mariadb/backup/
  1. /var/mariadb/backup/ contents is included in the snapshot

Questions:

  1. How do the mariabackup commands get executed mariadb container?
  2. How does the contents of /var/mariadb/backup/ get into the snapshot?

Additional consideration would also be needed during the restore process to restore the files to the mariadb data directory. Thoughts on if this implementation is feasible?

Alternatives:

As mentioned earlier in the thread FLUSH TABLES WITH READ LOCK will make the data files consistent. This lock would need to be maintained until the backup completed, and then unlocked. Writes would be suspended during the backup operation, but if the lock is able to be acquired quickly, and the files written to the snapshot quickly, then the impacts here might be acceptable. I'm not sure that we can assume that these operations will complete quickly in all scenarios though.

Overall, option 1 would probably be more robust, but would add complexity since it doesn't fit as neatly into the existing snapshot framework.

@oncleben31
Copy link

Other side effect the addon Nginx Proxy Manager is relying on the mariadb addon.

@0101binary0101
Copy link

Yep - I wouldn't say this issue was closed.

I've hit this issue yesterday/today - I had to go back to a snapshot from the 20th Dec to get things like bookstack recovered, it almost started to work but mysqld kept core dumping - lots of message Innodb' so I quickly issued a 'drop database homeassistant;' and then restarted homeassistant to let it re-create everything.

@jhampson-dbre
Copy link

jhampson-dbre commented Dec 31, 2020

It seems the MariaDB addon is running v10.4.13. Current 10.4 stable release is 10.4.17. Per release notes from 10.4.17-10.4.14, the following corruption and crash recovery bugs have been fixed:

  • Arbitrary InnoDB buffer pool and data file corruption (MDEV-24096)
  • Fixed corruption in delete buffering (MDEV-22497)
  • InnoDB data file extension is not crash-safe (MDEV-23190)
  • Doublewrite recovery can corrupt data pages (MDEV-11799)
  • Crash recovery fixes (MDEV-21347, MDEV-23190, MDEV-11799)

I'm not sure of a way to tell that any of these bugs specifically are causing the corruption, but upgrading the add-on the current 10.4 stable release could at least rule them out. Maybe this could be tested locally by upgrading the MariaDB package inside the running add-on container?

This also got me thinking, if a new version of the MariaDB add-on is released, is the data stored in the database migrated as well? Or is the old version container destroyed (along with the database) and just replaced with the new instance of the upgraded container?

@0101binary0101
Copy link

@jhampson-dbre
btw I couldn't find mariabackup in the container so not sure if the authors had included mariadb-backup in the packaging.

For the time being I've done an automation to hassio.addon_stop the addon_core_mariadb, partial backup just of the addon core_mariadb , wait 3mins while the backup is happening and finally hassio.addon_start of the hassio.addon_core_mariadb. This I execute 10 mins after my full backup...

@alexdepalex
Copy link

@jhampson-dbre Besides those fixes, just copying live data is a recipe for disaster. There area some settings which increase fault tolerance, but that will slow down the database, especially on installations running on usb sticks or sd cards.

I guess we'd need some kind of pre and post snapshot and restore hooks, that could be used for triggering a db backup and restore. Also, specifying or multiple backup paths (for backup directories) or excluding certain paths (like live db data) in the snapshot / restore code might be beneficial

@0101binary0101 Adding the mariadb-backup package is just a matter of adding it to the Dockerfile of the MariaDB add-on.
https://github.com/home-assistant/addons/blob/master/mariadb/Dockerfile

@jhampson-dbre
Copy link

jhampson-dbre commented Jan 1, 2021

@0101binary0101 It looks like the mariabackup utility is installed separately, despite the documentation saying: "It is included with MariaDB 10.1.23 and later". mysqldump utility is available, so that could be used instead of mariabackup without any additional installation.

There is also a hassio.addon_stdin that I think can run commands inside the add-on container. I'm going to play around with that this week to get automation that executes a mysqldump via hassio.addon_stdin and then initiates a snapshot. That way a good copy of the database should be in the snapshot, even if it would require an extra step to restore (which you could also probably solve with an automation to restore data from the dump file after the snapshot restore completes).

Update: MariaDB addon does not support sending commands using hassio.addon_stdin

ha addons info core_mariadb | grep -i stdin
stdin: false

This also got me thinking, if a new version of the MariaDB add-on is released, is the data stored in the database migrated as well? Or is the old version container destroyed (along with the database) and just replaced with the new instance of the upgraded container?

Doing some research on this, would it be possible to mount a data volume from the host into the MariaDB add-on container?

Update: MariaDB add-on already uses a persistent data volume by setting the default database directory in the Dockerfile to /data/databases. Looks like that directory is just tarred up. Looks like stopping the add-on before snapshot will be the best work around, until Supervisor can ensure data file consistency as part of snapshot process (e.g. issuing FLUSH TABLES WITH READ LOCK).

Some links on this topic:
mariadb - Where to store data?
How to make MariaDB database changes persistent

Some advantages of using external volumes:

  1. My understanding is the mounted volume is not included in the committed container (I think this is what snapshot is doing behind the scene). This could avoid the snapshotting process corrupting the MariaDB data files.
  2. Since the MariaDB data files are stored outside the container, the add-on could be updated without losing the data. The container with the updated add-on could just mount the same data volume to retain the data.

Disadvantages:

  1. In it's current form, the saved image from the snapshot process wouldn't save the data files. For example, restoring snapshot on a new system would result in an empty database, since the data volume would be external to the container. mariabackup or mysqldump could still be needed to have a "complete" backup of binaries, configuration, and data.
  2. Assuming no add-ons currently use volume mounts, this would be introducing additional complexity to the add-ons system.

@alexdepalex
Copy link

@jhampson-dbre The addon data directory is by default mapped to /data in the container as a bind mount. So the same goes for the MariaDB container. So there's no need for persistent volumes.

Snapshotting just creates tar files from the add-on data directories, collects them in one tar file and places it in the backup location.

In the case of MariaDB, a copy is made from the open database files, which introduces corruption. As I can see now, there's no mechanism in the snapshotting code to execute any pre or post actions during the snapshot. I guess that's something that needs to be worked on. In that case, we could perform an online backup of the database to ie /data/backup and exclude the MariaDB database files (MAP_FOLDER_EXCLUDE ) to avoid those being backed up.

When restoring the add-on, there should also be a post action which moves the data from /data/backup to the /data/databases directory.

@oncleben31
Copy link

I think the need for a pre and post hook for backup/restore should be requested in a dedicated issue. Who is volunteer to make it ?

@0101binary0101
Copy link

0101binary0101 commented Jan 2, 2021

@alexdepalex @oncleben31 - Agreed hooks to do pre-snap and post-snap

@jhampson-dbre - yep that's why I said that the mariadb-backup wasn't installed... Sure I could do a mysqldump ..but it's all about the fiddling and faffing around that you'd have to do is the pain during the restore.

For now I'm happy with my temporary solution of 10 mins after the full snapshot automation. I do an automation which does the following:

  • Service calls to stops the mariadb addon
  • delay 00:00:10 - (10secs) give the above service stop to complete
  • Service calls partial snapshot (just to do DB addon)
  • delay 00:03:00 - 3 mins (because the above service call for the ha snapshots is initiated to run and not inline executed, this may need adjusting for speed / size etc
  • Service call to start the mariadb addon

I could paste the full automation, but tbh I think the issue with pre-snap and post-snap should be addressed.

This way the snapshot contains the DB that was NOT RUNNING (no open files) at the time.

That way I have two snaps.. the full snapshot (with online potentially bad db) and then a correctly saved snapshot of just the DB.

For restoring/failovers I would restore the full snapshot and then restore the partial snaptop of the db (which would then have the bookstack and the homeassistant db intact ).

oncleben31 added a commit to oncleben31/home-assistant-config that referenced this issue Jan 3, 2021
Add a partial snapshot for only MariaDB with the addon stopped.
Linked to home-assistant/addons#1353.
@oncleben31
Copy link

I share my implementation of the work around.
I manage my snapshots with a Shell script in Bash using the addon "SSH & Web terminal". With this addon we can call a service from an automation to launch a script which can access all the environment of the addon (namely ha and hass-cli commands):

@bcutter
Copy link

bcutter commented Jan 17, 2021

@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
@fadamsen
Copy link

I am still affected by this.

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

e2m32 commented Mar 11, 2021

adding a me too

@Salvora
Copy link

Salvora commented May 6, 2021

+1

agners added a commit that referenced this issue Jun 8, 2021
pvizeli added a commit that referenced this issue Jun 17, 2021
* Add service which locks database tables

Add an additional service which helds a lock on all database tables.
This allows to safely snapshot the database files.

* Lock database during snapshot operation

Fixes: #1353

* Update config.json

* Update CHANGELOG.md

Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
@agners
Copy link
Member

agners commented Jun 19, 2021

The latest MariaDB Add-on 2.4.0 does essentially what MariaDB suggest when taking a file system level snapshot (and I outlined in #1353 (comment)). So snapshots taken with this version of the add-on should not lead to unrecoverable database snapshots anymore.

You should see something like this in the add-on log during snapshot:

[11:40:59] INFO: Lock tables using mariadb client...
[11:40:59] INFO: MariaDB tables locked.
[11:48:20] INFO: MariaDB tables unlocked.

@Salvora
Copy link

Salvora commented Jun 19, 2021

Can someone with a test bench confirm that it is working? I mean taking a snapshot and restoring it while mariadb is working?

@agners
Copy link
Member

agners commented Jun 21, 2021

FWIW, on my test instance a recovery of a snapshot taken while MariaDB running seems to have worked. I did make sure that data got written during snapshot, so it should represent a real world situation.

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