Hi all

We've been using RelStorage 1.1.c1 in production environments over
postgresql 8.1 for some time.   It has been working really fine, but
yesterday we have a big problem packing a relstorage zodb mounted as a
zope mount point.

We use the attached script to do packs.   The log says all was fine:
size: 3422069432
Sun Jan 18 22:11:31 CET 2009

But just one second later (22:11:32) a KeyError appears in event.log,
and the content of the database couldn't been seen in ZMI.   We try to
remount it, restart zope, and so on, but nothing works, so we had to
restore a backup.

That's the traceback of event.log:
Traceback (most recent call last):
File "/usr/local/zope/lib/python/ZODB/Connection.py", line 768, in setstate
File "/usr/local/zope/lib/python/ZODB/Connection.py", line 804, in _setstate
p, serial = self._storage.load(obj._p_oid, self._version)
File "/usr/lib/python2.4/site-packages/relstorage/relstorage.py", line
311, in load
self._log_keyerror(oid_int, "no tid found(2)")
File "/usr/lib/python2.4/site-packages/relstorage/relstorage.py", line
255, in _log_keyerror
rows = adapter.iter_object_history(cursor, oid_int)
File "/usr/lib/python2.4/site-packages/relstorage/adapters/common.py",
line 229, in iter_object_history
raise KeyError(oid)
KeyError: 7L

Anybody knows what could happen ?   Could be a problem access a
database during a pack process ?

Thanks in advance
Santi Camps (Earcon S.L.)
import logging

from ZODB.DB import DB
from relstorage.relstorage import RelStorage
import transaction
from persistent.mapping import PersistentMapping
import random, sys


use = 'postgresql'
if len(sys.argv) < 2:
    raise AssertionError("Use rspack.sg dbname")
dbname = sys.argv[1]
if dbname == 'oracle':
    use = 'oracle'
    if len(sys.argv) == 3:
        use = sys.argv[2]

if use == 'mysql':
    from relstorage.adapters.mysql import MySQLAdapter
    a = MySQLAdapter(db='%s' % dbname)
elif use == 'postgresql':
    from relstorage.adapters.postgresql import PostgreSQLAdapter
    a = PostgreSQLAdapter(dsn="dbname='%s'" % dbname)
elif use == 'oracle':
    from relstorage.adapters.oracle import OracleAdapter
    from relstorage.tests.testoracle import getOracleParams
    user, password, dsn = getOracleParams()
    a = OracleAdapter(user, password, dsn)
    raise AssertionError("which database?")

s = RelStorage(a)
d = DB(s)
c = d.open()

print 'size:'
print d.getSize()

print 'packing...'

print 'size:'
print d.getSize()

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to