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

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

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Thu, 24 Jun 2010 09:28:34 +0200


Some questions about how the workqueues... work.
Have I got it right?

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_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? 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?

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).
* 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.

I assume that the best thing would have been if all items could have
been placed in one workqueue and then be run but that we don't do that
since we don't want to increase the memory usage or slow down the system
by writing a lot of tempfiles holding the incoming changes.

My problem is that I haven't found the code parts that deals with
status_incomplete. I only see:
If write locks already held -> run the items left in the workqueues.

Received on 2010-06-24 09:29:29 CEST

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