Giter Site home page Giter Site logo

Comments (6)

pbauer avatar pbauer commented on August 22, 2024

@gotcha can you compare this with your issue?

from collective.exportimport.

ale-rt avatar ale-rt commented on August 22, 2024

Checking the code I suspected that get_dx_blob_path could have had the same issue, so I wanted to provide a PR for both.

But amazingly this does not happen with dx images:

(Pdb++) from collective.exportimport.serializer import get_dx_blob_path
(Pdb++) image
<plone.namedfile.file.NamedBlobImage object at 0x7fd9d829bed0 oid 0xca26d in <Connection at 7fd9ed5034f0>>
(Pdb++) with image._blob.open() as f: f.name.partition("blobstorage/")[-1] == get_dx_blob_path(image)
True

For whatever reason this works because the _p_serial is the same for the field instance and the blob:

(Pdb++) image._p_serial == image._blob._p_serial
True

from collective.exportimport.

ale-rt avatar ale-rt commented on August 22, 2024

Note, relying on blob._p_serial might not be good at all because when the blob is not loaded it has a value of '\x00\x00\x00\x00\x00\x00\x00\x00':

(Pdb) db._storage.fshelper.layout.getBlobFilePath(blob._p_oid, blob._p_serial)
'0x00/0x00/0x00/0x00/0x00/0x1f/0x16/0x07/0x00.blob'
(Pdb) blob.open()
<open file '/srv/recensio/deployment/work/zeo/parts/db-main/blobs/0x00/0x00/0x00/0x00/0x00/0x1f/0x16/0x07/0x038ed85d46749933.blob', mode 'rb' at 0x7f5b808627d0>
(Pdb) db._storage.fshelper.layout.getBlobFilePath(blob._p_oid, blob._p_serial)
'0x00/0x00/0x00/0x00/0x00/0x1f/0x16/0x07/0x038ed85d46749933.blob'

from collective.exportimport.

ale-rt avatar ale-rt commented on August 22, 2024

This is because the connection.set_state is not yet called:

(Pdb) tid
'\x00\x00\x00\x00\x00\x00\x00\x00'
(Pdb) debug blob.open()
ENTERING RECURSIVE DEBUGGER
> <string>(1)<module>()
((Pdb)) s
--Call--
> /srv/recensio/deployment/work/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py(848)setstate()
-> def setstate(self, obj):

from collective.exportimport.

gotcha avatar gotcha commented on August 22, 2024

@pbauer It is the same issue...

from collective.exportimport.

gotcha avatar gotcha commented on August 22, 2024

@ale-rt We had a similar issue where we made fixes to some objects that implied a different tid/serial between the blob wrapper and the blob...

That might explain why you do not see problems with dx objects. But AFAICS, there is also a wrapper and a blob so it seems they could have different tid/serial.

from collective.exportimport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.