Object identity

Florian Minjat florian.minjat at emn.fr
Tue Jun 12 13:07:25 UTC 2007


Chris Muller wrote:
> Hi Florian, this is an interesting problem.
> 
> First to answer your question, Magma identifies an object as already
> in the repository if it has a "permanent" oid.  This is an oid range
> between MaOidCalculator #firstUserObjectOid and #lastUserObjectOid.
> The #hash of an object never comes into play to determine this, or
> anything in Magma for that matter.
> 
> One way to get your large object-model into Magma would be to change
> the method MaObjectBuffer>>#ensureSpaceFor: to allow more than 10
> megabyte serializations.  I only suggest this only because it is an
> arbitrary limit and it looks like your model is right there just over
> the limit.  Change it to 50-meg on the fastest computer you have, It
> should work.  Submit the commit and let it run all night.

Great !
That should work very well.

> Another option would be to temporarily change your Players to
> reference the other players only logically; by some temporary id or
> something.  Once you get them loaded into Magma, then reset the
> references back to the actual objects.

This could be a good way too. But I don't know if it will be longer or 
not.
Yesterday I tried again to save all the Letters in a dictionary of 
Players, add all the Players in Magma, then put back the Letters 
inside the Players. But the last part was so slow I had to stop the 
whole process after about one hour. I don't understand this slowliness 
because thoses Letters are only some references to Players which 
should already be inside Magma.

The resulting code gives something like this (a mailbox is a 
collection of Letters):

mailboxes := Dictionary new.
players do: [:p | mailboxes at: (p login) put: (p mailbox). p mailbox: 
nil.].
session begin.
players do: [:p | session root players add: p. session commitAndBegin].
players do: [:p | |magmaPlayer| magmaPlayer := session players where: 
[:r | r login equals: (p login)]. magmaPlayer mailbox: (mailboxes at: 
(p login)). session commitAndBegin].

Perhaps the players references by the Letters in the last block are 
detected in Magma as not yet inserted and it does it again ?

> Note #maTransientVariables is available to implement on Player so it
> will not serialize those variables, so you could actually ADD a new
> logical reference, if necessary, and make the hard player reference
> transient (temporarily).

Do you have an example of use of a transient variable ? I way I 
understand it is that I make the Letters transients so they are not 
serialized inside magma, then I remove the transient property to load 
the Letters in a second pass ?

Thanks for your answer !

Florian


> Please let me know if these ideas are feasible.
> 
> - Chris
> 
> 
> On 6/10/07, Florian Minjat <florian.minjat at emn.fr> wrote:
>> Hi,
>>    I am trying to transfer a big object hierarchy to Magma : 110100
>> objects in 9004144 bytes.
>>    The basic structure is composed of ~70 Players with a lot of stuff
>> inside. Each players can have some Letters which references other
>> Players as sender or recipients.
>>    The problem is that I can't submit one player to an empty Magma
>> repository without letting Magma insert all the references Players.
>> And the resulting transaction is too big, causing an error. So I
>> separated all the Letters from the Players, inserted the players
>> (~50min) and then tried to insert the Letters. But I close the
>> connection to the magma repository between the two, so Magma tried
>> again to load all the references Players.
>>    So here is my question : how does Magma identify a given object as
>> already inside a repository ? Does it compare the hash of the objects
>> and I just need to redefine the hash method of Players ?
>>    Each try is quite long so I would like to understand a little more
>> of the inner mechanisms of Magma instead of trying numerous times.
>>
>> Florian
>> _______________________________________________
>> Magma mailing list
>> Magma at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/magma
>>
> 


More information about the Magma mailing list