[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn_fs/svn_repo repository lock API

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Wed, 08 Aug 2012 15:25:22 +0100

"C. Michael Pilato" <cmpilato_at_collab.net> writes:

> On 08/08/2012 07:38 AM, Philip Martin wrote:
>> I've been asked about using operating system snapshots to make backups
>> of live repositories. These could be filesytem snapshots like ZFS or
>> FreeBSD's UFS2, or block level snapshots like Linux's LVM, or maybe even
>> a Windows shadow copy. The reasons for using snapshots, rather than
>> "svnadmin hotcopy", are that it's a better fit with the overall backup
>> strategy or that it is faster or requires less disk space or less IO.
>> This has also been discussed on the mailing lists, e.g.
>> http://svn.haxx.se/users/archive-2012-02/0233.shtml
>> As far as I know the snapshot method should work provided there are no
>> bugs in Subversion or the snapshot code but it would be good to have
>> more confidence that it works.
>>
>> One of our customers asked about locking the FSFS write-lock file before
>> taking the snapshot as this would halt writes and make the repository
>> quiescent. It's certainly possible to do it, I wrote a program that
>> calls the private API svn_fs_fs__with_write_lock, but calling a private
>> API is a hack and I need to lock the rep-cache as well.
>>
>> So I was wondering whether we should introduce a public API to do this
>> properly either at the svn_fs_ or svn_repos_ level. For FSFS this would
>> stop writes while allowing reads. A BDB implementation would probably
>> stop reads as well.
>
> This seems reasonable. I can envision the likes of an
> svn_fs_freeze()/svn_fs_unfreeze() API pair, with svn_repos_* flavors thereof
> for adding hook support.

I had not considered hook support. Would that be pre-freeze and
post-unfreeze hooks? Or something (not sure what) to do with the
existing hooks?

A _freeze/_unfreeze API would work but a callback interface like
svn_fs_fs__with_write_lock (_with_freeze or _frozen) means that
repository is unfrozen automatically even if the callback fails, so no
dangling frozen repositories. It practice it makes little difference
since the main user would be svnadmin, or a imilar program, that is
short lived and will unfreeze on exit.

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download
Received on 2012-08-08 16:26:11 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.