[ZODB-Dev] zodb4: adding an object before transaction commit

Toby Dickenson tdickenson at geminidataloggers.com
Mon Oct 6 12:06:12 EDT 2003


On Monday 06 October 2003 16:46, Shane Hathaway wrote:

> FWIW, here is the way we do this in ZODB 3:
>
> f._p_jar = root_object._p_jar
> get_transaction().commit(1)
>
> The object "f" receives a _p_oid during subtransaction commit.  A
> documented API would be better.

Ive recently discovered a disadvantage with my use of this subtransaction 
approach..... I use it in several cases where an object is added and then 
removed from Zope folders in the same transaction. This short-lived object 
wouldnt normally be written to the storage because it isnt reachable at the 
end of the transaction. Ive recently discovered that it is being written, 
leading to a moderate amount of storage bloat, because of a subtransaction 
that occurs at a time when it is reachable.

The proposed API looks good.

-- 
Toby Dickenson




More information about the ZODB-Dev mailing list