Closed (fixed)
Project:
Drush
Component:
SQL
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
30 Nov 2010 at 18:03 UTC
Updated:
19 Dec 2010 at 04:30 UTC
Jump to comment: Most recent file
Sorry for the unrelated lines at top of this patch
I am looking for an even faster way to save database dumps. The attached patch enhances sql-dump such that when --result-file is passed without a value, then drush generates a date based filename and stores the dump in the backups directory (i.e. the one that updatecode uses).
I'd like some feedback on this.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | dumpfile-2.patch | 3.54 KB | greg.1.anderson |
| dumpfile.patch | 2.45 KB | moshe weitzman |
Comments
Comment #1
greg.1.anderson commentedPostgres users need love too.
I don't think that we should mix %dump and --result-file. These options can each be set separately; if the user wants them to go to the same location, they can set both values to point to the same place.
Rather than #2, I put in a simple str_replace so that drushrc.php could remain simple and still use date-based dump dirs if desired. Sure, you could drop in the current date with some php code in drushrc.php, but you couldn't substitute in the database name...
Anyway, I like the concept.
Comment #2
luchochs commentedNot tested, but is a good idea/proposal.
Comment #3
luchochs commented$options['result-file'] = 'use-backup-dir';might be a better option, I think.Update: 'use-backup-dir' instead of 'backup-dir'.
Comment #4
moshe weitzman commented@luchochs - you suggest to treat the string backup-dir as a pointer to updatecode's backup directory? i think TRUE is slightly clearer, IMO. RTBC I think. Nice improvement.
Comment #5
luchochs commentedProductive exchange of ideas.
Comment #6
greg.1.anderson commentedCommitted.
Comment #7
moshe weitzman commentedI should really test better. Our command looks great
mysqldump --result-file /Users/mw/.drush-backups/20101201115643/modules/wef_20101201_115643.sqlBut mysql is won't create that dynamic directory name for us. So,
I think $this->prepare_backup_dir() needs to create the dir unless we are in simulate mode.
postgress uses >> to write to filesystem. Maybe mysql should do that too? Long ago I got some some unspecific advice that this was less reliable than --result-file due to charset issues. Is this possible?
Comment #8
greg.1.anderson commentedI'll clean this up. I think that postgres should use --file=...
I can't think of a good reason why >> should have any issue with charsets. I remember that you told me once that pipes took more memory than using intermediate files, but I never independently confirmed this, nor do I know whether >> is, on a low level, any different than a pipe. Conventional wisdom is that there should be no difference between using temp files and memory on Unix, but in practice it could be important on hosting services with little available RAM.
Comment #9
luchochs commentedThis code was committed, therefore is a bug now.
Comment #10
moshe weitzman commentedComment #11
jonhattan@moshe I've fixed in #987064: Store backups in a better subdirectory a bug introduced in your previous change to backup.inc: it was not creating the $date/modules directory and also it was not calling prepare_backup_dir() but prepare_back_dir().
So #7 is fixed. Not tested for pg but I expect it also works.
I suppose this is what you want: /home/jonhattan/.drush-backups/20101202133339/d15_20101202_013340.sql
Also it would be nice to printout the location of the dump.
Comment #12
moshe weitzman commentedA bit awkward but done nevertheless.