Opened 15 years ago
Closed 14 years ago
#8954 closed enhancement (fixed)
[PATCH] trac-admin hotcopy should export database dump for non-sqlite projects
Reported by: | Thijs Triemstra | Owned by: | Thijs Triemstra |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | admin/console | Version: | 0.11-stable |
Severity: | normal | Keywords: | bitesized, patch, mysql, postgresql |
Cc: | Branch: | ||
Release Notes: |
Back up the database during a |
||
API Changes: | |||
Internal Changes: |
Description
Would be nice to have a mysql/postgress db dump when using trac-admin ENV hotcopy DEST
. We already have all the necessary functionality, as we do a backup during upgrades. We could store the dump in the ENV/db
directory before the copy operation.
From #8952
Attachments (3)
Change History (17)
comment:1 by , 15 years ago
Milestone: | → next-minor-0.12.x |
---|
comment:2 by , 15 years ago
Keywords: | bitesized added |
---|
comment:3 by , 15 years ago
Priority: | normal → high |
---|
comment:4 by , 14 years ago
Milestone: | next-minor-0.12.x → unscheduled |
---|
comment:6 by , 14 years ago
Reporter: | changed from | to
---|
comment:7 by , 14 years ago
Keywords: | patch added |
---|---|
Owner: | set to |
Status: | new → assigned |
Summary: | trac-admin hotcopy should export database dump for non-sqlite projects → [PATCH] trac-admin hotcopy should export database dump for non-sqlite projects |
The attached patch creates a 'db-backup.sql' in the environment folder which get copied in the hotcopy destination folder. MySQL trac installations don't have a db
folder so I copied it to the root of the environment. Maybe a db
folder for non-sqlite backups should be made when using hotcopy that can hold the .sql file?
follow-up: 9 comment:8 by , 14 years ago
Milestone: | unscheduled → 0.13 |
---|
A db
folder even for non-SQLite backends would make sense, yes. However, shouldn't the dump rather be placed into a db
folder of the destination instead of the source, probably after the copytree()
call? That would avoid having a possibly large file (the dump of t.e.o is over 2 GB) placed twice in the filesystem.
by , 14 years ago
Attachment: | sql-hotcopy-8954-2.patch added |
---|
follow-up: 10 comment:9 by , 14 years ago
Replying to rblank:
A
db
folder even for non-SQLite backends would make sense, yes. However, shouldn't the dump rather be placed into adb
folder of the destination instead of the source, probably after thecopytree()
call? That would avoid having a possibly large file (the dump of t.e.o is over 2 GB) placed twice in the filesystem.
The attached patch creates a db
folder where the sql dump is created. I was wondering if a cmdline option like --no-database
(to exclude the db export for hotcopy) or --database
(to include the db export for hotcopy)? With 2GB databases the user might want to skip the export db option?
follow-up: 11 comment:10 by , 14 years ago
Replying to thijstriemstra:
I was wondering if a cmdline option like
--no-database
(to exclude the db export for hotcopy) or--database
(to include the db export for hotcopy)? With 2GB databases the user might want to skip the export db option?
That's a good idea indeed. Probably --no-database
, so that it's included by default.
comment:11 by , 14 years ago
Replying to rblank:
That's a good idea indeed. Probably
--no-database
, so that it's included by default.
Sounds good. I guess a status message (Exporting database…) might be useful as well, I reckon it takes quite a while to export a 2GB db, and without such a message users might think hotcopy crashed or died.
by , 14 years ago
Attachment: | sql-hotcopy-8954-3.patch added |
---|
comment:12 by , 14 years ago
The attached patch adds the ability to ignore the database export (inc sqlite) using the --no-database
or -d
flag. For example:
trac-admin ../test2 hotcopy ../testerr/ Hotcopying /Users/thijstriemstra/Sites/projects/opensource/test2 to ../testerr/ ... Exporting database... Hotcopy done.
Without database:
trac-admin ../test2 hotcopy ../testerr/ --no-database Hotcopying /Users/thijstriemstra/Sites/projects/opensource/test2 to ../testerr/ ... Hotcopy done.
comment:13 by , 14 years ago
Keywords: | mysql postgresql added |
---|
comment:14 by , 14 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Patch applied in [10387] with very minor changes:
DatabaseManager.backup()
already creates the destination directory if it doesn't exist, so there's no need to do it in_do_hotcopy()
.- For SQLite, exclude only the database file if
--no-database
is specified, not the completedb
directory, as it could contain other files (e.g. backups from upgrades). - Removed the short form of the
--no-database
option.
Thanks for your great work!
PatchWelcomed.