Feature idea: symlink to newest (and oldest?) saved backup

7 views
Skip to first unread message

Micah Yoder

unread,
Aug 12, 2010, 7:12:12 AM8/12/10
to Holland Backup
Hi, got this idea from a request in a customer ticket and it seems
like it would make sense for Holland.

How about, in the per-backupset directory, which contains all the
saved backups for the set, have a symlink that is always updated to
the newest backup, and maybe another one that always points to the
oldest backup that still exists?

I could probably get to that if there's interest.

Tim Soderstrom

unread,
Aug 12, 2010, 9:06:07 AM8/12/10
to hollan...@googlegroups.com
Hi Micah!

That's a really good idea! That would simplify things for those writing custom scripts around Holland and certainly would make things easier when having to do a quick restore!

I suspect this may not be a trivial change but if we cannot include it in 1.0 it could be rolled into our 1.1 feature-list. I would recommend logging a tagged feature in GIT about this one. Something we should definitely look into!

> --
> WIKI: http://wiki.hollandbackup.org
> CODE: http://github.com/holland-backup
> UNSUBSCRIBE: holland-deve...@googlegroups.com
>

Tim Soderstrom

unread,
Aug 12, 2010, 9:32:11 PM8/12/10
to hollan...@googlegroups.com
Sure man. I'd say go for it!

Sent from my iPhone

Micah Yoder

unread,
Aug 27, 2010, 9:38:56 AM8/27/10
to Holland Backup
Possible implementation idea, let me know what you think. Untested:

In the Backupset class (spool.py)

def updateSymlinks(self):
backups = self.list_backups()
oldest_path = os.path.join(self.path, backups[0].path)
newest_path = os.path.join(self.path, backups[-1].path)
oldest_link = os.path.join(self.path, 'oldest')
newest_link = os.path.join(self.path, 'newest')
os.remove(oldest_link)
os.remove(newest_link)
os.symlink(oldest_path, oldest_link)
os.symlink(newest_path, newest_link)

Then call it from some post backup handler?

Tim Soderstrom

unread,
Aug 27, 2010, 11:10:32 AM8/27/10
to hollan...@googlegroups.com
I would have to play around with that to see how it worked but that's looks sensible to be (though I'm not a very good source for sensibleness :). Have you tried using this in your own branch yet?

Alex Brandt

unread,
Aug 27, 2010, 11:41:10 AM8/27/10
to hollan...@googlegroups.com

The only possible issue I see with it is that it assumes the list coming back from self.list_backups is chronologically sorted (which is fine if this is true).

--

Alex Brandt

Linux Administrator, RHCE

http://www.alunduil.com

Micah Yoder

unread,
Aug 28, 2010, 3:25:25 AM8/28/10
to Holland Backup
Just added it and commited it to my repo. Works great!

[micah@micah-desktop pgdump]$ ll
total 32
drwxrwx---. 3 micah micah 4096 Aug 5 08:49 20100805_084941
drwxrwx---. 3 micah micah 4096 Aug 5 08:53 20100805_085301
drwxrwx---. 3 micah micah 4096 Aug 28 02:20 20100828_022018
drwxrwx---. 3 micah micah 4096 Aug 28 02:21 20100828_022115
lrwxrwxrwx. 1 micah micah 56 Aug 28 02:21 newest -> /home/micah/env/
var/spool/holland/pgdump/20100828_022115
lrwxrwxrwx. 1 micah micah 56 Aug 28 02:21 oldest -> /home/micah/env/
var/spool/holland/pgdump/20100805_084941

Some changes were made to the above code, and I added it as a post-
backup callback.

Alex, yes, that assumption is correct:

def list_backups(self, name=None, reverse=False):
"""
Return list of backups for this backupset in order of their
creation date.
"""
[...]

Tim Soderstrom

unread,
Aug 30, 2010, 6:11:57 PM8/30/10
to hollan...@googlegroups.com
Looks good, Micah!

I think this is a worth addition though I'll let some of the others on this list weigh in to see what they think. Otherwise, I'm good with pushing this into 1.0.5 since that is still in development.

Andrew Garner

unread,
Aug 30, 2010, 7:02:47 PM8/30/10
to hollan...@googlegroups.com
I think this is a worthwhile feature. Feel free to send a github pull request.

~Andy

Reply all
Reply to author
Forward
0 new messages