ADAM'S WEB PRESENCE

2 September 2006

Subversion recovery

Filed under: Nerd Notes — adam @ 11:38 pm

I’ve been using Subversion for a while now to manage the source code for my hobby projects. I like it, it is easier to use than CVS and it doesn’t trash your files like Visual Source Safe does. Also there is the very excellent Tortoise GUI to make it even nicer.

However, Subversion has one REALLY annoying problem. About once a month it just freezes up solid and refuses to commit any files. It has never lost any of my data but I think I’ll stick to CVS for my professional work.

Anyway before this turns into a rant, the purpose of this post is to write down the magical incantations to un-wedge Subversion so that next time it freezes I can just read my own blog rather than spending half an hour trying to figure it all out again

First shut down the web server

# /etc/init.d/apache2 stop

Then run either the Berkely recovery utility or the Subversion recovery utility depending on which component has frozen - or just run both. Here’s the commandline for Subversion recovery:

# svnadmin recover /home/subversion/<project-name>

and here’s the Berkely recovery commandline:

# db4.2_recover -c -v -h /home/subversion/<project-name>/db

Then adjust the permissions on all the files so that the web server can read and write them

# cd /home/subversion/<project-name>

# chown -R www-data.www-data *

And finally we can fire up the web server again.

# /etc/init.d/apache2 start

PS. I’m running Debian Etch Beta and using Apache2 as my web server. This procedure may be slightly different on other configurations. YMMV.

4 Comments »

  1. Comment by Ben — 11 October 2006 @ 1:54 pm

    Maybe switching the backend to fsfs instead of Berkeley DB will solve your problems? What’s the split between BerkeleyDB and Subversion “freezes”?

  2. Comment by adam — 11 October 2006 @ 8:23 pm

    I haven’t really been keeping score, it seems about 50-50.

  3. Comment by adam — 6 March 2007 @ 1:44 pm

    OK, I think I have a solution. After digging through the Subversion documentation, it would seem that the problem comes down to permissions and ownership of the DB files. Sometimes I have been accessing the repository from my local machine and other times remotely via Apache. This is a very bad thing to do according to the Subversion people. So I have simply created a new policy. I must always access Subversion via Apache, even on the local machine. This has been working so far. I will see how it goes over the next few check-ins.

  4. Comment by adam — 15 January 2008 @ 9:22 am

    Yep, that was it. I haven’t had any problems since I’ve been accessing it exclusively through Apache.

RSS feed for comments on this post. TrackBack URI

Leave a comment


Powered by WordPress