Modify ↓
Opened 4 years ago
Last modified 3 years ago
#20672 new enhancement
Backup rotation scheme for preferences.xml
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | backup rotation preferences | Cc: |
Description
Currently, JOSM only keeps one preferences.xml_backup
which is overridden after each save, sometimes leading to corrupt files (e.g. see #18569)
JOSM could keep a bunch of backup files named preferences.YYYY-MM-DD.xml
, and delete older files according a backup rotation scheme, such as keeping
- one backup file older than 1 hour, and,
- one backup file older than 1 day, and,
- one backup file older than 3 days, and,
- one backup file older than 1 week, and,
- one backup file older than 1 month, and,
- one backup file older than 1 year.
Attachments (0)
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
I don't think the implementation is overly complicated:
- List all
preferences.YYYY-MM-DD.xml
- Parse date
- Sort descending
- Filter files according to the scheme
- Delete files not matching 4
Note:
See TracTickets
for help on using tickets.
Don't overdo it. This happens seldom and it's not an application task to setup a backup strategy for lazy users.
I recently implemented a scheme which I believe to be a reasonable compromise.
First Backup is created when rewriting the original file. Second backup gets first backup in this case, but only if the size of first and second differ. For JOSM it could probably be another rule like that it must be at least 2 days old.
Probably more helpful would be a "prevent writing config" mechanism like loading the current config and comparing it with the new one. And only save the file at all when it really changed. That drastically reduces the changes to corrupt the config.