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

Re: How does the workqueues provide atomic updates, or do they?

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 24 Jun 2010 09:20:22 +0100

Daniel Näslund <daniel_at_longitudo.com> writes:

> How are files installed during an update?
> ----------------------------------------
> We acquire a write lock
> We crawl the wc
> We tell the repos about our state
> The repo runs an editor
> open_root(): We set status to _status_incomplete
> open_directory(): We set status t _status_incomplete.
> close_file(): We run the wq
> close_directory(): We run the wq

close_directory will remove status_incomplete for the directory, see
maybe_bump_dir_info. At present it's a direct database operation but
it may become part of the wq for the directory.

> close_edit(): Remove status_incomplete
> release write_lock
>
> What if we get interrupted?
> ----------------------------
> We have this incoming change:
> M A/B/lambda
> M A/B/beta
>
> But we only process lambda and get cancelled before we start processing
> beta. Then there's no wq started for beta. How does the wq know that the
> update isn't complete?

The wq doesn't know or care. All the wq knows is whether there are
outstanding items.

> Or is the status that tells us that the update is
> not complete? E.g. the workqueues provide write atomicity but it's the
> status that tells us if the whole operation has succeded?

The status_incomplete remains on the directory. It will remain until
the user runs update successfully.

> I think it works like this:
> ------------------------------
> * If the next operation tries to acquire a write lock it will fail and
> tell the user to run 'svn cleanup'
> * svn_wc_cleanup() will run all remaining work items in the different
> workqueues (will be one queue when we have one db).

Yes. Although note that pool cleanups attempt to run any outstanding
wq so controlled cancel will often run any wq and remove locks, just
leaving the incomplete status.

> * Something detects that the update is incomplete and resumes it *or*
> something detects that the update is incomplete and reverts what has
> been done so far.

No. In future it may change but at present the user needs to invoke
update to finish the operation.

-- 
Philip
Received on 2010-06-24 10:21:09 CEST

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.