dokku / dokku-mariadb

a mariadb plugin for dokku
MIT License
73 stars 26 forks source link

Locking tables #56

Closed crisward closed 7 years ago

crisward commented 8 years ago

The export command (mysql dump) by default locks all the tables. For a big export on a large site this can cause the site to become unresponsive. Although locking tables protects data consistency, it's often better to risk that and not kill the site during a backup.

So I propose changing https://github.com/dokku/dokku-mariadb/blob/master/functions#L64

from

docker exec "$SERVICE_NAME" mysqldump --user=mariadb --password="$PASSWORD" "$SERVICE"

to

docker exec "$SERVICE_NAME" mysqldump --lock-tables=false --user=mariadb --password="$PASSWORD" "$SERVICE"

Thoughts?

If it helps, we did it on the previous mariadb plugin - https://github.com/Kloadut/dokku-md-plugin/commit/91fb68ec15ae0721c37444b3b96cf9f03438ef55

josegonzalez commented 8 years ago

I'd rather this be optional. I'll take a look in a bit.

crisward commented 8 years ago

Thanks..

It would perhaps make sense for this to apply to the general database api. Not sure if it has an equivalent in postgres / rethink etc. If not, perhaps an ability to pass though options to mysql dump. So just dokku mariadb:export MYDB --lock-tables=false ?

josegonzalez commented 8 years ago

Probably we would not lock tables by default and then have the flag be --lock-tables. That would ease migration into this functionality.

crisward commented 8 years ago

Sounds cool. Thanks.

crisward commented 8 years ago

If you haven't got time for this, let me know and I'll do a pull request.

josegonzalez commented 8 years ago

I'd like to roll it into this work here: https://github.com/dokku/dokku-redis/issues/64

crisward commented 8 years ago

Makes sense..

josegonzalez commented 7 years ago

Closing in favor of the mentioned issue.