[ZODB-Dev] Loading objects directly by OID

Greg Ward gward@mems-exchange.org
Mon, 5 Nov 2001 16:02:09 -0500


On 05 November 2001, Barry A. Warsaw said:
> >From a practical standpoint, I think the answer is yes, this is
> possible.  I say this because I've seen this happen in my
> FS->BDB migration tests.  I take a FS for real live data, use
> copyTransactionsFrom() to create a BDB from this, and then do a pack()
> on the BDB database.  I've definitely seen pickles containing
> references to other objects (oid) that are not in the database.

That's interesting to hear.

I don't think that's *exactly* the situation I'm encountering, though.
Note that I worded my question quite carefully:

  ... but for B to not be loadable via the storage's load()
  method?

B (the object referenced by object A), certainly appears to be in the
database.  It gets loaded if I follow object references to get to it,
eg. if I do dir(A).  But I can't load it by passing its OID to the
storage's load() method.

You're probably thinking, "Greg, you dolt, the object isn't being
loaded, it's sprining into existence because of something in your
code".  I'm still open to that idea, but:
  * the object springs into existence with the same OID every time
  * that OID is *not* max_oid + 1
  * I put a print statement in the relevant constructor; while it
    is firing at inappropriate times (which is a problem, but it's
    our problem), it doesn't seem to go off here

I'm going to try to strip the database in question down more -- I
already got it from 80 MB down to 2 MB, but there are still a couple
thousand objects in it.  Then maybe I can throw it at one of you guys
and you can tell me if our storage is (gulp) corrupt, or if I'm just
making incorrect assumptions about the nature of FileStorage.

        Greg