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

Using "svnadmin freeze"

From: Philip Martin <philip_at_codematters.co.uk>
Date: Fri, 31 May 2013 13:35:57 +0100

One of my colleagues at WANdisco asked some questions about using
freeze. The first thing he wanted to know is how to detect whether a
freeze is running. There are various approaches: look at running
processes, look at processes with the lock file open, implement some
external lock, etc. but none are reliable or portable. The only
reliable way to do it is for Subversion to provide some sort of
implementation.

A freeze query might be implemented by having a separate freeze lock.
The freeze function itself would then take the freeze lock before taking
the write lock, and the freeze query would try a non-blocking lock of
the freeze lock. This would probably go into the repos layer to avoid
duplicate implementations.

I think something like that would work but I'm unsure whether we should
provide it. I'm concerned that it would be making freeze special.
Would we need to provide similar queries for upgrade, recover, pack,
etc?

A second point was about adding a timeout to freeze. At present freeze
blocks until it gets the write lock and will wait as long as it takes.
There is no timeout in APR's file locking API so to implement a timeout
we would need to either sit in a loop attempting non-blocking locks or
use SIGALARM to cause EINTR. I think that would work but again I'm
unsure how useful this feature would be.

A timeout leads on to a question was about error handling. At present
the return value of "svnadmin freeze repository program" is the return
value of the external program provided freeze managed to run the
program. If freeze failed to run the program for some reason then the
return value is generated by svnadmin directly. There is no way to
distinguish errors from 'program' from errors from 'svnadmin', they both
return values in the range 0-255. Success, zero, is unambiguous but any
error is difficult to interpret.

I don't see any easy way round this. If we stop providing the 'program'
error as the return value how else do we provide it? Write it to
standard output in some known form? Invoke some post-freeze command and
pass it as a parameter?

-- 
Philip
Received on 2013-05-31 14:36:55 CEST

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