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

Re: Add warning to svnadmin recover, WAS: FW: repository too slow suddenly

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-08-15 04:23:15 CEST

Garrett Rooney wrote:
> Matt Blais wrote:
>
>> It's not possible for svnadmin to lock it while it's being recovered?
>
> It's more complex than that. svnadmin recover needs to be able to deal
> with the case where a client or server crashed while holding the lock,
> so at some point it needs to be able to blow away the lock if it's invalid.

OK, so it's more complex, but not very complex. So really, wouldn't you say that it is possible and desirable for svnadmin to lock it while it's being recovered and for other accesses to lock it while they are in progress, as long as a "recover --break-lock" option is available with a suitable warning message?

My ideas added in pseudo-code:

mark benedetto king wrote (in thread "repository too slow suddenly"):
>
> For normal opens:

Is there a single place for this, or once in each of the three RA layers, or many places?

...
> status = apr_file_open(&file, lockfile, APR_READ | APR_WRITE,
> APR_OS_DEFAULT, pool);
...
> /* note: we could remove the nonblock here and simply block until
> recovery is complete. */
> status = apr_file_lock(file, APR_FLOCK_SHARED | APR_FLOCK_NONBLOCK);
> if (status) {
> error("repository is currently being recovered!");
> }

     /* associate some sort of program identification with the lock */
     echo $PID:$0 > lockfile # or whatever

>
>
> And for recover:
>
> status = apr_file_open(&file, lockfile, APR_READ | APR_WRITE,
> APR_OS_DEFAULT, pool);
...
> status = apr_file_lock(file, APR_FLOCK_NONBLOCK);
> if (status) {
> error("repository is currently in use!");

       locked_by = [determine RA layer type, program name, process id.,
         etc. from lock file if possible];

This is to help the administrator find out what is or was aceesing it, when he believed that nothing was doing so.

       error("The repository appears to be in use by "(locked_by)".
              If you are sure that this is not so, then run
                svnadmin recover --break-lock
              to remove the "in use" indication and proceed with recovery.
              Note that if recovery is forced while the repository is in fact
              being accessed, then the repository will be corrupted.");

> }

     /* associate some sort of program identification with the lock */
     echo $PID:"svnadmin recover" > lockfile # or whatever

>

  And for "recover --break-lock":

     Delete the lock file and then lock it as for "recover",
     or lock it with APR_FLOCK_FORCE(?),
     or whatever is the best way to break (actually, steal) the lock.
     Then continue with recovery.

Is it possible to use the existing lock mechanism that all regular access to the DB must already respect (handled internally by Berkeley DB libs, I assume)? It seems a shame to add our own on top unless it is essential to do it that way.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 15 04:25:18 2003

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.