[ZODB-Dev] Inquiry: subtransaction commits w/ FileStorage

Jeremy Hylton jeremy@zope.com
Tue, 11 Dec 2001 12:49:08 -0500 (EST)


The machinery for handling the subtransactions is in the data manager
(aka _p_jar).  There's nothing in the underlying storage that knows
about subtransactions.

The tpc_begin() method of a Connection object get things started by
creating a TmpStore to hold the subtransaction data.

    def tpc_begin(self, transaction, sub=None):
        if self._invalid(None): # Some nitwit invalidated everything!
            raise ConflictError("transaction already invalidated")
        self._invalidating=[]
        self._creating=[]

        if sub:
            # Sub-transaction!
            _tmp=self._tmp
            if _tmp is None:
                _tmp=TmpStore.TmpStore(self._version)
                self._tmp=self._storage
                self._storage=_tmp
                _tmp.registerDB(self._db, 0)

        self._storage.tpc_begin(transaction)

I'm not too familiar with this code, so I'm not sure where
self._storage gets rebound to the actual storage object.  But I'm sure
it happens somewhere :-).

Jeremy