Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine and increase options for triggering a backup #24

Closed
wellread1 opened this issue May 23, 2020 · 6 comments
Closed

Refine and increase options for triggering a backup #24

wellread1 opened this issue May 23, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@wellread1
Copy link

Thanks for the very nice plugin.

I use the long term backup feature provided by KPSimpleBackup but rely on KeePass synchronization to a cloud drive for "continuous" backup. I would prefer to avoid the extra overhead incurred by the Simple Backup that occurs with each KeePass save event, and would rather defer these backups to a more convenient time, such as when KeePass has been inactive for a while.

Would it be possible to:

  • Provide an option to disable backup on saving in favor of the existing backup on database closing option?
  • Add an option for periodic backup when KeePass has been inactive for a specified period?
  • Keep track of "database has unsaved changes" since a backup so deferred backups (periodic, or on db closing) would be made only when the database has changed since the last backup.
@marvinweber
Copy link
Owner

marvinweber commented May 24, 2020

Thx for your feedback, so regarding your points:

  • You can disable performing backups on every save (Advanced -> General Backup Options -> Auto Backup Database)
    Instead you can enable backups when KeePass or the database is closed (Advanced -> Advanced Backup Options -> Backup database whent it's...
  • I think with the current implementation of the plugin this is not possible, since your database probably get's locked after some time of inactivity.
    I'll check if it is possible somehow, but I don't think so...
    "Backups on close" - as described above - are no suitable solution for you?
  • This is probably possible, I'll try to look into it :)

@wellread1
Copy link
Author

Thanks! Argh! I did not notice the option to disable the auto-backup. Backup on close will work nicely for me.

FYI: A "Time-Periodic" event is exposed in the trigger system. The interval can be set in this event to a value shorter than the KeePass locking interval. Though I am not a developer, the existence of this event in the trigger system seems to imply the event will also accessible to plugins.

@marvinweber marvinweber added the eval Evaluation is required label May 25, 2020
@jon-f-novastor
Copy link

jon-f-novastor commented Aug 28, 2020

Regarding the mentioned existing option it may have one unwanted affect still if disabling the option whereby it still saves at Workspace Lock / Automatic Workspace Lock trigger time, at least in my testing using the latest release versions of KPSimpleBackup 1.3 and KeePass 2.4.5. The existing option that was discussed "Advanced -> Advanced Backup Options -> Backup database when it's...", when that option is disabled (unchecked) it still saves the database when the workspace is locked, whether if manual lock or when auto lock trigger is hit. It does not say it will do that in the option description text but it does do that in my testing today and it does not seem to matter the other combination of options utilized both in Keepass 2.4.5 and in KPSimpleBackup. In my case I would rather not have it do this additional save operation then on workspace lock only event, I only want it to perform the save if I close the database or if the application is exited (which is how the option is described to work). The option we are talking about (in disabled state) is:

image

I reported that issue today as a new issue: 'If option 'Backup database when it's being closed or when the KeePass application is being closed' is disabled, it saves the database when the database is being locked': #26.

With this option disabled it still may bother some to do all of the saves to multiple backup locations including two cloud locations, including Long Term Backup saves, each time the Workspace Lock is called or the Automatic Workspace Lock is triggered (by the lock timer setting in KeePass). In this case it has to sit there saving all of the databases each time the workspace locks, in my case that is 45 seconds in total, which means I cannot get back in to untray the app while it is doing that save, and the saves occur every time the workspace hits the auto lock workspace trigger, which is unwanted. The time it takes to do all of these save operations each time the workspace lock is called (with the KPSimpleBackup option disabled) is lengthened by the encryption strength settings, the speed of the system, and the number of backup locations. As suggested by wellread1 here it would be a great idea to be able to have a new option that allows a time-periodic type of save whereby it calls the "Backup Database now!" function after a set number of idle time in minutes (idle time using KeePass) is reached. However, since KeePass is normally configured to lock the workspace/database automatically after set timeout that may not be a viable ability as a new option. Thank you for making a great plugin!

@marvinweber marvinweber added this to the v1.4 milestone Apr 6, 2021
@marvinweber marvinweber added enhancement New feature or request and removed eval Evaluation is required labels Apr 7, 2021
@marvinweber marvinweber self-assigned this Apr 7, 2021
marvinweber added a commit that referenced this issue Apr 8, 2021
If user enabled "backup on close" trigger, the backup is now
only created if the database really has been modified.
Therefore, a new handler stores the "modified state" in an
internal flag every time the database is being saved (but not
close).

refers to #24
@marvinweber
Copy link
Owner

A new backup for the option "Backup on Database Close" will now only be created when the database has been changed (even if you change the database, save it, and then close it -> this will still trigger a backup; meaning you can disable the "Auto-Backup on Save" and enable "Backup on Close" and still, a backup will be created everytime you change your database - when you close it).
This will be included in the upcoming Version 1.4.

However, I decided against a periodic backup trigger/interval, as I don't see the benefit: If you backup everytime you save, you don't need any further periodic backups. If you backup on close, you also make a backup when the database has been modified (assuming that you use a reasonable lock-interval, the risk of missing a backup due to a crash or similar is rather low. To minimize this risk, you should let the backups run when you save the database, anyway.

@marvinweber
Copy link
Owner

@jon-f-novastor

it still saves the database when the workspace is locked, whether if manual lock or when auto lock trigger is hit

Yes, this correct. The option you mentioned creates backups when you close or lock your database, or when KeePass is closed (as this closes the database, as well).
The description of that option wasn't very good, I aggree :( I updated them to be more precise and will also update the descriptions in the Wiki to explain that in more detail.


In this case it has to sit there saving all of the databases each time the workspace locks, in my case that is 45 seconds in total

Regarding the performance issues with the long-term-backups: This will be addressed in this ticket: #28

marvinweber added a commit that referenced this issue Apr 12, 2021
If user enabled "backup on close" trigger, the backup is now
only created if the database really has been modified.
Therefore, a new handler stores the "modified state" in an
internal flag every time the database is being saved (but not
close).

refers to #24
@jon-f-novastor
Copy link

jon-f-novastor commented Apr 12, 2021

Thanks @marvinweber, your resolve for issue #24 as to no longer trigger the save if nothing was modified, was the main issue I had in regards to save DB on close/lock/exit, which was the reason for my follow-up comment, as even if nothing was modified in the database it was adding 22 seconds (using v1.3, two local C: drive for the destinations (Google Drive and Syncthing) with LTB enabled, I believe in that case it was triggering many individual save operations) every time it either reached the lock database trigger or if the app was exited. That is why I had the save on lock or close option disabled in v1.3. The fact that I had disabled that option to get around the wait period ultimately was not good because I found that I would never utilize the KPSimpleBackup plugin menu to perform a manual save operation there, so my target folder that the plugin was set to utilize had no recent backups in it at all I noticed when I went to upgrade v1.3 to v1.4 today. Note: For me as tested today the time it takes to lock the database is still 22 seconds in KPSimpleBackup v1.4, as it was in v1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants