• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More automatic backups
#1
I don't recall if I suggested it already. But I'd like to have the option to make more than one automatic backup copy of the database, preferably the amount configurable to the user.

It's coming from recurring problems opening the database on my 4 W10 devices. Since I haven't read about similar problems from other users in the forum I'm guessing it's caused by my unique way of synchronizing my database between the devices with resilio sync and using junctions.

But it occurs from time to time (on different devices) that MSP can't open neither the last database nor the automatic backup. I cant fathom the cause and so far could avoid a desastrous data loss by often backing up the database manually or restoring the most current from one of the other devices.

But I really like to have more automatic backups on the specific device for being able to restore a relatively current database in a performance situation etc. when database and the first backup fail again.
Reply
#2
Would you want me to perform a daily backup of the database? Hourly? You said make it configurable, but I'm not sure if you mean the interval at which a backup is created or the number of backups to keep. That seems like it would have to be a separate setting. Then there is the issue of how often to clean up all those backups. I also only create backups when the app is first loaded right now, so if you want a background task to periodically create backups, that would require more changes and usually you want the database closed before generating a backup file, so I'd have to close/reopen it which could cause delays in the application if anything else accesses the database during the backup (which should only be a small pause unless your database is enormous). 

This really is a request that most users would not benefit from - the automatic database backups are only there for catastrophic data loss, which should almost never happen in regular usage. Your use of resilio sync and junctions must be related to this. It seems to me you could just use an external application to create periodic backups of the database file if needed. 

Mike
Reply
#3
No, I'm just talking about not overwriting the backup already the next time you close or start the app. So the number of backups to keep. Just let MSP save a configurable amount of the database (like mobilesheets_auto_backup_1.db and so on mobilesheets_auto_backup_2.db) before overwriting the oldest again if the configured amount of backups . Nothing more. Probably just a job of renaming the older backup before saving. Personally I don't need an automatic clean or delete. But since not all users will work with exposed database or with the folders on Windows there should be something from the GUI I guess.

If you don't think it would be of general use (not only for the catastrophic data loss which would have happened to me if I hadn't copied and backupped manually, but also maybe for returning to a previous version for some reason) then don't implement it. But I know it from several editors or office programs where multiple copies of documents are saved so I thought of this here, too.
Reply
#4
(04-07-2020, 06:43 AM)BRX Wrote: No, I'm just talking about not overwriting the backup already the next time you close or start the app. So the number of backups to keep. Just let MSP save a configurable amount of the database (like mobilesheets_auto_backup_1.db and so on mobilesheets_auto_backup_2.db) before overwriting the oldest again if the configured amount of backups . Nothing more. Probably just a job of renaming the older backup before saving. Personally I don't need an automatic clean or delete. But since not all users will work with exposed database or with the folders on Windows there should be something from the GUI I guess.

If you don't think it would be of general use (not only for the catastrophic data loss which would have happened to me if I hadn't copied and backupped manually, but also maybe for returning to a previous version for some reason) then don't implement it. But I know it from several editors or office programs where multiple copies of documents are saved so I thought of this here, too.

I backup /sychronize to a dropbox folder - and there have been multiple times when my tablet lay at home and I needed newer files to be on my dropbox but I forgot to synchronize for a longer time. The appealing idea of a synchronisation on a configurable intervall crossed my mind several times.... So I would vote for that. But that seems a bit different to the topic or am I mistaken there...
Reply
#5
@Mike

I suggest you allow the users to specify how many backups they wish to retain. For efficiency, this should be limited to a small number e.g 1-5 (what about 0?). This value probably wants to default to 3.
Rather than appending numbers to the filenames, I would append dates e.g. mobilesheets_auto_backup_yyyy-mm-dd.db (makes it more obvious to the user which one he might like to use) [edit] Although using fixed numbers might make it easier for user using a script to copy the files to other devices [/edit]

When making a backup, scan the backup directory to count the number of existing backups and determine their dates (use the file date stamp rather than anything embedded in the name). This info probably needs to be saved in a small array in case more than one file needs to be deleted e.g. the user has reduced the number of backups to be retained (from 5 to 1 say).

If the number of existing backups is greater or equal to the desired number of backups, delete the oldest backup and repeat this test.
Then create the backup as you do already.

Another alternative would be to just delete the oldest backup each time before creating a new backup. The code that stores the number of backups could ensure that any excess backups are deleted when the value is reduced. However, this means duplicating the deletion logic so it is probably best to keep deletion to the creation process (it also means that backups are retained as long as possible)

I don't know what you do about multiple starts on the same day (or in a short period). These could easily "flush" the automatic backups. Probably not an issue in normal running but could be if the user is experiencing problems and keeps trying to restart MSP. Perhaps best to limit to one automatic backup a day (hopefully, the user will never need them)

You would also need to devise a mechanism so that the user can select which automatic backup he would like to restore. This would also need to allow a choice of another backup if the first ones tried aren't suitable (don't create any more backups until the user is satisfied that the recovery is good - don't want to flush the backups)

Personally, I don't shut my tablet or MSP down so I don't know if taking it out of hibernation would trigger this code (I suspect not). For users like me, you might have to have a mechanism that detects that the program has been running for more than 24 hours and that a backup is due. This backup could be suppressed if the program hadn't been used in this period.

I'm sure I'm teaching you how to suck eggs

Keep safe
Geoff
Samsung Galaxy Tab A6
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.