Commit 7d0a92de authored by Jim Fulton's avatar Jim Fulton

In constructor, moved storage creation code below basic data setup.

This was to fix a bug caused by an interaction with ZEO that caused a
process to be unable to start if the ZEO client cache contained stale
data.
parent 28f93d04
......@@ -84,8 +84,8 @@
##############################################################################
"""Database objects
$Id: DB.py,v 1.23 2000/08/18 15:53:25 jim Exp $"""
__version__='$Revision: 1.23 $'[11:-2]
$Id: DB.py,v 1.24 2000/09/16 02:38:54 jim Exp $"""
__version__='$Revision: 1.24 $'[11:-2]
import cPickle, cStringIO, sys, POSException, UndoLogCompatible
from Connection import Connection
......@@ -121,31 +121,15 @@ class DB(UndoLogCompatible.UndoLogCompatible):
pool_size -- The size of the pool of object spaces.
"""
self._storage=storage
storage.registerDB(self, None)
if not hasattr(storage,'tpc_vote'): storage.tpc_vote=lambda *args: None
try: storage.load('\0\0\0\0\0\0\0\0','')
except:
import PersistentMapping
file=cStringIO.StringIO()
p=cPickle.Pickler(file,1)
p.dump((PersistentMapping.PersistentMapping,None))
p.dump({'_container': {}})
t=Transaction()
t.description='initial database creation'
storage.tpc_begin(t)
storage.store('\0\0\0\0\0\0\0\0', None, file.getvalue(), '', t)
storage.tpc_vote(t)
storage.tpc_finish(t)
# Allocate locks:
l=allocate_lock()
self._a=l.acquire
self._r=l.release
# Setup connection pools and cache info
self._pools={},[]
self._temps=[]
self._pool_size=pool_size
self._cache_size=cache_size
self._cache_deactivate_after=cache_deactivate_after
......@@ -155,6 +139,24 @@ class DB(UndoLogCompatible.UndoLogCompatible):
self._miv_cache={}
# Setup storage
self._storage=storage
storage.registerDB(self, None)
if not hasattr(storage,'tpc_vote'): storage.tpc_vote=lambda *args: None
try: storage.load('\0\0\0\0\0\0\0\0','')
except:
import PersistentMapping
file=cStringIO.StringIO()
p=cPickle.Pickler(file,1)
p.dump((PersistentMapping.PersistentMapping,None))
p.dump({'_container': {}})
t=Transaction()
t.description='initial database creation'
storage.tpc_begin(t)
storage.store('\0\0\0\0\0\0\0\0', None, file.getvalue(), '', t)
storage.tpc_vote(t)
storage.tpc_finish(t)
# Pass through methods:
for m in ('history',
'supportsUndo', 'supportsVersions', 'undoLog',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment