[OpenAFS-devel] Ubik transactions and locks?

Jeffrey Hutzelman jhutz@cmu.edu
Wed, 06 Dec 2006 01:10:41 -0500


On Saturday, December 02, 2006 08:07:45 PM +0100 Tommie Gannert 
<d00-tga@d.kth.se> wrote:

> Hi!
>
> What is the difference between Ubik's transactions
> and locks?
>
> The source says that only one Write transaction can be active at
> any one time, but also that "this has nothing to do with
> transaction locking".
>
> There are three transaction modes (read, read-any and write)
> and two lock modes (read and write)... So far so good, but
> what does a write-lock do that a Begin(write) doesn't? Does it just
> lock any readers out? Could any readers active during a Commit read
> inconsistent data?

Transaction modes are not about locking; they're about telling the 
transaction layer whether you plan on making any changes to the database 
during this transaction.  A write transaction can only be carried out when 
a quorum is present, and then only on the coordinator, which is the only 
server allowed to write to the database.  However, a write transaction does 
not lock out readers on that server or any others, and does not prevent 
readers from seeing inconsistent data -- for that you need to use locking.

The reason multiple simultaneous write transactions are not permitted is 
due to a limitation in the transaction logging and recovery code, which 
does not support recording operations from more than one transaction at the 
same time.

The difference between "read" and "read-any" transactions is that the 
latter are allowed to run even when there is no quorum.  AFS uses read-any 
transactions for its protection and volume location databases, where 
returning stale data is considered preferable to providing no service at 
all.

-- Jeffrey T. Hutzelman (N3NHS) <jhutz+@cmu.edu>
   Sr. Research Systems Programmer
   School of Computer Science - Research Computing Facility
   Carnegie Mellon University - Pittsburgh, PA