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

sean.upton@uniontrib.com sean.upton@uniontrib.com
Wed, 12 Dec 2001 09:12:40 -0800


lsof turned out to be helpful here.  My INSTANCE_HOME is /var/lib/zope
(Debian):

dev2:~# lsof | grep python | grep var | grep 398
python2.1 256    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted)
python2.1 395    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted)
python2.1 396    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted)
python2.1 397    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted)
python2.1 398    root    3w   REG        9,0      91819   915717
/var/lib/zope/var/Z2.log
python2.1 398    root    4u   REG        9,0          4   915715
/var/lib/zope/var/Data.fs.lock
python2.1 398    root    5u   REG        9,0        434   915720
/var/lib/zope/var/Data.fs.tmp
python2.1 398    root    6u   REG        9,0  349929173   915714
/var/lib/zope/var/Data.fs
python2.1 398    root   13u  unix 0xedc130a0                2484
/var/lib/zope/var/Z2-pcgi.soc
python2.1 398    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted)
python2.1 399    root   19u   REG        9,0   52566068  1242754
/var/tmp/@398.0 (deleted) 

Sean

-----Original Message-----
From: jeremy@zope.com [mailto:jeremy@zope.com]
Sent: Tuesday, December 11, 2001 9:49 AM
To: sean.upton@uniontrib.com
Cc: zodb-dev@zope.org
Subject: Re: [ZODB-Dev] Inquiry: subtransaction commits w/ FileStorage


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