ZODB icon indicating copy to clipboard operation
ZODB copied to clipboard

The ZODB should create the "tmp" directory for savepoint automatically if the target directory does not exist.

Open zopyx opened this issue 2 years ago • 3 comments

A savepoint() call may cause the error

  File "/home/ajung/src/unibo/magazine-plone6/eggs/transaction-3.1.0-py3.11.egg/transaction/_transaction.py", line 627, in __init__
    savepoint = savepoint()
                ^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 984, in savepoint
    self._commit(None)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 544, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 591, in _store_objects
    s = self._storage.storeBlob(oid, serial, p, blobfilename,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1186, in storeBlob
    targetpath = self._getBlobPath()
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1215, in _getBlobPath
    blob_dir = tempfile.mkdtemp(dir=self.temporaryDirectory(),

if the target directory does not exist. Better: the directory should be created automatically rather than failing implicitly.

zopyx avatar Oct 25 '23 12:10 zopyx

What was the error at the end of the traceback?

davisagli avatar Oct 25 '23 17:10 davisagli

Sorry for incomplete information.

The savepoints for blobs are created (by default) inside var/blobstorage/tmp. Only var/blobstorage existed.

This is also true in other contexts where the ZODB/Zope expects directory to exist for var/logs, var/instance, var/filestorage etc.

zopyx avatar Oct 25 '23 17:10 zopyx

@zopyx What storages is your ZODB configured with?

From what I can see this temporary directory should normally be created when the blob storage is initialized: https://github.com/zopefoundation/ZODB/blob/master/src/ZODB/blob.py#L377-L378

davisagli avatar Oct 28 '23 19:10 davisagli