django-dbbackup
django-dbbackup copied to clipboard
'--single-transaction' flag added to mysql backup generation command
Fixes #372
Thanks for making this. I think it would be worthwhile to write about this in the documentation that this indeed is happening. Linking to the dba post would be good to do as well.
@jonathan-s I have updated the PR with a few changes. Could you review these changes?
Thank you for making an update!
Given that --single-transaction
only works for one storage in mysql it sounds like it would make more sense for that to be False by default.
Assume that you were using a two different storage engines in mysql and you dumped both databases at the same time. If you included the flag would you get a fatal error? Or would it just ignore the flag for the engine that didn't support it?
Lastly, a question regarding ergonomics, right now you've defined it as setting. Given that this flag is something you might want to use on certain supported databases in MySQL would make more sense to put this flag on the command itself?
Ie here -> https://github.com/django-dbbackup/django-dbbackup/blob/master/dbbackup/management/commands/dbbackup.py#L21-L37
Assume that you were using a two different storage engines in mysql and you dumped both databases at the same time. If you included the flag would you get a fatal error? Or would it just ignore the flag for the engine that didn't support it?
I have done a few tests on my local machine and it seems MySQL isn't raising any error or unexpected behavior while using the --single-transaction
flag in other engines. This leads me to believe that Mysql simply ignoring the flag if we are using it in a different, un-supported engine.
The rest of your arguments are seemed good to me, will do the necessary changes asap.
Codecov Report
Merging #373 (d92ddec) into master (246c1dd) will decrease coverage by
0.71%
. The diff coverage is22.22%
.
@@ Coverage Diff @@
## master #373 +/- ##
==========================================
- Coverage 90.87% 90.16% -0.72%
==========================================
Files 19 19
Lines 855 864 +9
Branches 173 176 +3
==========================================
+ Hits 777 779 +2
- Misses 42 47 +5
- Partials 36 38 +2
Impacted Files | Coverage Δ | |
---|---|---|
dbbackup/apps.py | 100.00% <ø> (ø) |
|
dbbackup/checks.py | 80.64% <14.28%> (-19.36%) |
:arrow_down: |
dbbackup/db/mysql.py | 96.96% <50.00%> (-3.04%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 246c1dd...d92ddec. Read the comment docs.