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

Re: Recover a corrupt repository

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-12-14 10:47:41 CET

On Dec 14, 2007, at 03:36, Jonathan Ashley wrote:

>>> Be *very* careful using svnsync in a post-commit script directly.
>>> The locking method does not really work properly, and if two
>>> users commit simultaneously, the target repository becomes
>>> broken. This has happened to me.
>>>
>>> I worked around it by writing a small daemon process that listens
>>> for
>>> incoming TCP/IP connections on a port and runs svnsync as a result.
>>> The post-commit hook just makes this connection. That guarantees
>>> that only one svnsync will run at a time.
>>
>>
>> But... but... but... only one commit can happen at a time. And the
>> commit is not over until the post-commit script has finished running.
>> Therefore, if you run svnsync in the post-commit hook, there can
>> already only be one svnsync process running at a time.
>
> Well I could be wrong of course, but I think I've got some
> pretty convincing evidence that that isn't the case.

Sorry, you're right. I just ran a test where I wrote a post-commit
hook that spends 10 seconds writing lines to a log file:

#!/bin/sh
REV="$2"
for ((i=1;i<=10;i+=1)); do
        sleep 1
        echo r$REV - $i >> /tmp/post-commit.log
done

I committed different things simultaneously from two different
working copies, and the revision numbers were indeed interleaved in
the logfile. So you're right. The commit is over before the post-
commit hook runs, and post-commit hooks from different revisions can
run simultaneously. I hadn't realized that would be the case.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Dec 14 10:48:06 2007

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

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