[ZODB-Dev] FileStorage iteration data records missing data_txn

Jim Fulton jim at zope.com
Fri Jan 9 11:39:16 EST 2009


On Jan 9, 2009, at 7:41 AM, Christian Theune wrote:

> Hi,
>
> in ZEORaid we switched from using `restore` to `store` for replaying
> transactions from another storage and found that the data records that
> FileStorage returns aren't filling in the `data_txn` fields correctly,
> but end up writing `None` all the time.

What makes you think this is incorrect?

data_txn should:

1. Not be in the interface.  It is an optimization that depends on a  
peculiarity of FileStorage of a case that only arises (today) with  
undo.  I'm inclined to remove this optimization. In fact, in the  
presence of blobs, the optimization is dubious.  This implies that the  
prev_txn argument to restore should be ignored.

2. data_txn should only be other than None for a record that was part  
of an undo.  It is used to avoid copying data. Rather than copying  
data, we simply record the position of the earlier record that  
contains the data.


> I'm not exactly sure how to fix this, but attached is a patch that  
> makes
> it work for the cases I could come up with.
>
> I'd like to add this change to the trunk (I'll write tests if this
> change gets accepted).


Your patch is incorrect.  data_txn is not the previous record  
transaction id.  It is the transaction id of the transaction  
containing data when the current record doesn;t contain any.  It is  
used as an optimization by referring to data stored in an earlier  
record rather than copying data to the current record.

The relevant interface didn't originally mention this field. The  
documentation you added is incorrect. I'm going to remove the field  
(along with version and tid) from the interface.

Jim

--
Jim Fulton
Zope Corporation




More information about the ZODB-Dev mailing list