-
Notifications
You must be signed in to change notification settings - Fork 7
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
Keep last n items #5
Comments
I initially thought this is what "recent" is about. I thought wrong. After 2,2TB and a successful snapshot transfer, it chose to delete the last and only source snapshot :( After some testing, i think "recent" should be named "hours". +1 for keeplast implementation. I would call it "latest" and rename recent to hours. |
Thanks for the feedback Wolfgang and Bernd! I agree that the paradigm of "keep the last N" is intuitively useful. In fact, that is what I thought initially. But things seem to be a little more complicated than that. The following example hopefully shows that simply keeping the last N can result in data loss, too, when invoking timegaps very frequently. An item younger than 1 hour is in the "recent" category. Let's imagine timegaps was to keep the 5 most recent (as you wrote, the 5 last or newest items) in that category. Let's imagine items are created at a high rate, e.g. every two minutes. Let's consider the case where timegaps is invoked at a high rate, too (many times per hour, regularly or irregularly). In this example scenario items would be deleted before they get to be 1 hour old. Propagation of the older items would not happen; and timegaps would break one of its promises. It is precisely this effect which made me switch to the "keep the oldest items" paradigm. I seem to have thought about that a few years ago and wrote this into the TODO file:
Got that from here: Line 29 in fffaf13
Now, you brought up very valid concerns. What can we do? What if we were to keep the oldest N and the newest M in the "recent" category (again, this is where all items are in that are younger than 1 hour)? That would ensure backpropagation of the oldest items. In an extreme case it could still rip a hole of <1 hour into the item distribution, though. In terms of thinning data out this should be desired. However, if that is a problem in any workflow the only viable solution is to add another time category with a more fine-grained resolution than 1 hour. This is just me thinking out loud! |
Related: #3 (comment) Another relevant thought: not thinning out in the "recent" category should be an option. Is it currently? |
Usecase - productive ZFS server makes snapshots via cronjob every 0 and 30 minutes after the hour and only once a day these snapshots are transfered offsite to another server with zfs send command.
After transfering snapshots to offsite system I would like to clear some snapshots on productive system. But I must assure to keep (in any case) the last snapshot for the next incremental zfs send - so a keeplast1 would be needed.
Another usecase from this would be that on the productive Server I would like to assure to keep the latest 10 snapshots in any case (independed of creation time).
Everything after the 10 recent snapshots can be thinned out with hours,days,weeks etc.
So categorie keeplast would be helpfull.
Probably a helpful source would be the program Restic Backup
I use Restic for some other backups and that's where I'm used to have a keep-last parameter.
Again ;-) interessted in your thoughts.
Greetings Wolfgang
The text was updated successfully, but these errors were encountered: