Corrupt database?
Jerry Bell
jdbell at oxfordmetamedia.com
Mon May 11 21:58:13 UTC 2009
Hi,
You might be interested in trying the hack I used. No guarantees,
and you should make sure you have good backups etc.
Basically it tries to catch errors such as the ones we've run into and
uses the in-image definition for loading the objects from disk.
I'm sure there are many ways this can break, but it might work for
what you need. I'm using it as a temporary part of a process that
will hopefully fix my issue, I don't plan to keep it loaded in my
images once my database is repaired.
In MaFixedObjectBuffer>>createObjectUsing: try something like this:
skeleton _ indexedSize = 0
ifTrue: [ class basicNew ]
ifFalse: [ [class basicNew: indexedSize]
on: Error do: [sourceDefinition := inImageDefinition.
indexedSize := self objectInstSize.
class basicNew] ].
-Jerry
On May 11, 2009, at 3:03 PM, Hernán Morales Durand wrote:
> 2009/5/7 Chris Muller <ma.chris.m at gmail.com>:
>>
>> Option 2: What matters is that STBUser buffers in the repository all
>> point consistently to the correct class version. Write a script
>> using
>> MagmaFileTraverser to interrogate all of the Fixed buffers ("type =
>> 3") where classId=126, check that their versions all are correct and
>> consistent with their number of instVars of the Buffer
>> (#objectInstSize).
>
> I have a similar problem ( 'DateQualifier cannot have variable sized
> instances' ) but in my case there's only one version of DateQualifier,
> ( i.e. aMagmaClassIdManager definitionForClassId: 378 version: 2 fails
> because non-existent index). Here objectInstSize = 2 and
> sourceDefinition namedInstSize = 3, resulting in indexedSize = -1 and
> performing the #basicNew:
>
> #namedInstSize is correct, the DateQualifier's superclass has 3
> instance variables, the output of Jerry's first script would be:
>
> Index: 1 Version: 1 ivar count: 3
>
> So I wrote the script you suggested:
>
> ( MagmaFileTraverser for: 'Magma' ) open
> anchorGraphDo: [ : buffer |
> ( buffer classId = 378 and: [ buffer class = MaFixedObjectBuffer ] )
> ifTrue: [ buffer objectInstSize inspect ]
> ].
>
> but still fails with the same error. My problem is that I cannot open
> the repository to commit any corrections because of this error.
>
> 11 May 2009 4:47:59 pm
> VM: Win32 - a SmalltalkImage
> Image: Squeak3.10.2 [latest update: #7179]
>
> SecurityManager state:
> Restricted: false
> FileAccess: true
> SocketAccess: true
> Working Dir C:\Squeak 3.9
> Trusted Dir C:\Squeak 3.9\hmorales
> Untrusted Dir C:\My Squeak\hmorales
>
> DateQualifier class(Object)>>error:
> Receiver: DateQualifier
> Arguments and temporary variables:
> aString: 'DateQualifier cannot have variable sized instances'
> Receiver's instance variables:
> superclass: AbstractTitleQualifier
> methodDict: a MethodDictionary(#distantGetter->a CompiledMethod
> (720) #initiali...etc...
> format: 136
> instanceVariables: nil
> organization: ('printing' printOn: printQualifierOn:)
> ('initialization' distant...etc...
> subclasses: nil
> name: #DateQualifier
> classPool: nil
> sharedPools: nil
> environment: a SystemDictionary(lots of globals)
> category: #'DocModel-Titles'
>
> DateQualifier class(Behavior)>>basicNew:
> Receiver: DateQualifier
> Arguments and temporary variables:
> sizeRequested: -1
> Receiver's instance variables:
> superclass: AbstractTitleQualifier
> methodDict: a MethodDictionary(#distantGetter->a CompiledMethod
> (720) #initiali...etc...
> format: 136
> instanceVariables: nil
> organization: ('printing' printOn: printQualifierOn:)
> ('initialization' distant...etc...
> subclasses: nil
> name: #DateQualifier
> classPool: nil
> sharedPools: nil
> environment: a SystemDictionary(lots of globals)
> category: #'DocModel-Titles'
>
> MaFixedObjectBuffer>>createObjectUsing:
> Receiver: a MaFixedObjectBuffer
> oid : 16861039
> classId : 378
> objectInstSize : 2
> commitNumber : ...etc...
> Arguments and temporary variables:
> aMaObjectSerializer: a MaObjectSerializer
> class: DateQualifier
> skeleton: nil
> indexedSize: -1
> sourceDefinition: a MaClassDefinition DateQualifier
> version = 1
> inImageDefinition: a MaClassDefinition DateQualifier
> version = 1
> eachOid: nil
> sourceIndex: nil
> targetIndex: nil
> Receiver's instance variables:
> byteArray: a ByteArray(242 159 4 0 176 14 62 0 0 0 62 0 0 19 115 0
> 99 81 1 0 0 ...etc...
> startPos: 299
>
> MaObjectSerializer>>newSkeletonFor:fromProxy:
> Receiver: a MaObjectSerializer
> Arguments and temporary variables:
> aMaObjectBuffer: a MaFixedObjectBuffer
> oid : 16861039
> classId : 378
> objectI...etc...
> aMaMutatingProxy: nil
> skel: nil
> Receiver's instance variables:
> oidManager: a MagmaOidManager
> classIdManager: a MagmaClassIdManager
> preMadeObjectBuffers: an Array(a MaByteObjectBuffer
> oid : 16149077336050
> cla...etc...
> graphBuffer: a MaSerializedGraphBuffer (6168 objects in 303090
> bytes)
> createProxyBlock: [] in MagmaSession>>initializeSerializer {[:oid |
> MagmaMutati...etc...
> traversalStrategy: a MaObjectGraphTraversalStrategy
> amBusy: true
> truncatedObjects: a WeakIdentityKeyDictionary()
> preferences: a MaObjectSerializerPreferences
> bpMapIndex: 1
>
>
> --- The full stack ---
> DateQualifier class(Object)>>error:
> DateQualifier class(Behavior)>>basicNew:
> MaFixedObjectBuffer>>createObjectUsing:
> MaObjectSerializer>>newSkeletonFor:fromProxy:
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> [] in MaObjectSerializer>>materializeGraphDo: {[skeletons add:
> (Association key: (newObject := self newSkeletonFor: each ...]}
> [] in MaWeakValueDictionary(MaDictionary)>>maAt:ifPresent:ifAbsent:
> {[^ zeroArgBlock value]}
> MaWeakValueDictionary(MaDictionary)>>at:ifAbsent:
> MaWeakValueDictionary(MaDictionary)>>maAt:ifPresent:ifAbsent:
> [] in MagmaOidManager>>objectWithOid:ifFound:ifAbsent:
> {[(MaOidCalculator isOidForNewObject: anInteger) ifTrue: [newObjects
> ma...]}
> MaOidCalculator class>>objectWithOid:ifNone:
> MagmaOidManager>>objectWithOid:ifFound:ifAbsent:
> MaObjectSerializer>>objectWithOid:ifFound:ifAbsent:
> [] in MaObjectSerializer>>materializeGraphDo: {[:each | object :=
> self objectWithOid: each oid ifFound: [:foundObj...]}
> [] in MaSerializedGraphBuffer>>buffersDo: {[:eachPosition | buffer :=
> preMadeBuffers at: (self bufferTypeAt: eachP...]}
> MaSerializedGraphBuffer>>bufferPositionsDo:
> MaSerializedGraphBuffer>>buffersDo:
> MaObjectSerializer>>materializeGraphDo:
> MaObjectSerializer>>materializeGraph:do:
> [] in MagmaSession>>materializeObject: {[serializer
> materializeGraph: aByteArray do: [:eachObject :eachBuffer | ...]}
> ...etc...
>
> Any other suggestion?
>
> Hernán
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
More information about the Magma
mailing list