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.

https://en.wikipedia.org/wiki/Backup_rotation_scheme

Change History (3)

comment:1 by stoecker, 4 years ago

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.

  • Original file
  • First Backup
  • Second Backup

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.

comment:2 by simon04, 4 years ago

I don't think the implementation is overly complicated:

  1. List all preferences.YYYY-MM-DD.xml
  2. Parse date
  3. Sort descending
  4. Filter files according to the scheme
  5. Delete files not matching 4

comment:3 by skyper, 3 years ago

See #22376 for a ticket about losing the preferences.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.