[ZODB-Dev] ZODB4 Data.fs corruption?

Marius Gedminas mgedmin@codeworks.lt
Tue, 21 Jan 2003 13:45:55 +0200


I'm trying to connect to Zope 3's Data.fs from a Python script, and the
file gets corrupted.  I managed to reproduce this with the following
code:

  from zodb.storage.file import DB
  db = DB('Data.fs')
  connection = db.open()
  root = connection.root()
  from zope.app.publication.zopepublication import ZopePublication
  root_folder = root.get(ZopePublication.root_name, None)

  from zope.pagetemplate.pagetemplate import PageTemplate
  try:
      del root_folder['foo']
  except KeyError:
      pass
  root_folder.setObject('foo', PageTemplate())

  from transaction import get_transaction
  get_transaction().commit()

  connection.close()

  db.close()

You can run it successfully, but after that other programs that try to
access the same Data.fs start complaining:

  No handlers could be found for logger "zodb.storage.file.FS40"

  ------
  2003-01-21T13:43:25 WARN zodb.storage.file.FS40 Data.fs time-stamp reduction at 10435
  ------
  2003-01-21T13:43:25 ERROR zodb.storage.file.FS40 Data.fs incorrect previous pointer at 10458

If I remove the last line (db.close()), I get no corruption, and the
transaction is commited successfully.

Is this a bug in zodb4?

Marius Gedminas

P.S. Cc:ing replies would be appreciated, as I'm not subscribed to zodb-dev.
-- 
Codeworks is available for Zope consulting -- http://www.codeworks.lt/