[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: Fri, 10 Aug 2012 10:05:35 +0100

Branko Čibej <brane_at_wandisco.com> writes:

> On 10.08.2012 01:15, Philip Martin wrote:
>> Philip Martin <philip.martin_at_wandisco.com> writes:
>>
>>> Yes, I think so. The process executes something like
>>>
>>> pragma locking_mode = exclusive;
>>> begin exclusive transaction;
>>> commit transaction;
>>>
>>> and then the lock persists until the database connection is closed or
>>> the process exits.
>> I think it might also work with a rollback instead of a commit since
>> exlusive locking mode doesn't release write locks until the database is
>> closed.
>
> You're aware that your recipe will lock out readers of the database,
> too? I thought the idea was to make the repository read-only, not
> inaccessible.

It might be possible to do:

        BEGIN TRANSACTION;
        INSERT INTO rep_cache VALUES ('dummy', 0, 0, 0, 0)

The INSERT should cause SQLite to take a RESERVED lock. This will block
until existing writes complete and will then block subsequent writes but
will not block readers. We would never COMMIT this transaction and it
would disappear when the repository is unfrozen, so no permanent change
is made to the rep-cache.

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

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