[ZODB-Dev] Backing up a ZODB

Jeremy Hylton jeremy at zope.com
Wed Oct 29 22:01:05 EST 2003


On Wed, 2003-10-29 at 18:18, Tim Peters wrote:
> [Tim Peters]
> >> That little status byte is first set to 'c', then the new
> >> transaction is appended, and then it seeks back to the location of
> >> the status byte and overwrites it with a blank.  That's the way in
> >> which filestorage isn't changed solely by appending.
> 
> [Neil Schemenauer]
> > Interesting.  Is that done because the size of the transaction is
> > not known before it is written?
> 
> We'd have to channel Jim to know why it was done this way to begin with.

We do it that way to implement two-phase commit.  The FileStorage can't
finish the first phase until it can guarantee that it can commit the
data.  Our implementation of "guarantee" is that all the bytes are
written and flushed before tpc_vote() returns.  It's still possible for
the transaction to abort at this point.  If there is a catastrophic
failure after tpc_vote(), we don't want to leave the Data.fs with a
valid transaction record for a transaction that never committed.

Jeremy





More information about the ZODB-Dev mailing list