Bug 46055

GemStone/S 64 Bit

3.3

3.3.1

Upgrade: need to recompile all persistent blocks, including for sorted collections

The upgrade process from v3.2 to v3.3 requires that all source code be recompiled, since there are new bytecodes.  The upgrade instructions in the Installation Guide inadvertently do not mention this requirement for blocks, including the common case of the sortblocks for persistent SortedCollections.

Workaround

After upgrading to v3.3, you must recompile the sortblocks of all persistent SortedCollections.  This can be done with the postconv script, with a modification to allow recompile as well as conversion.  During the 3.2.x to 3.3 upgrade, after the upgradeImage, but before running the postconv script, log into the repository as SystemUser, file in the method below, and commit.

The details of postconv conversion are otherwise the same as for recompiling blocks for 2.4.x upgrade, see: Convert persistent blocks (this is from the Linux Installation Guide, but the instructions are the same on all platforms)

Note that complex sortblocks, such as sortblocks referencing self or block or method variables, cannot be automatically recompiled; postconv flags such SortedCollections for manual recompilation.

If your application stored blocks other than in SortedCollection sortBlocks, you will have to locate and recompile all these blocks as well.

category: 'Repository Conversion'
classmethod: SortedCollection
convertAll: anArray usingCache: dict hiddenSetForErrors: hsIdx

"Convert an Array of SortedCollections by recompiling their sort blocks from
 SimpleBlocks to ExecBlocks, or if already ExecBlocks but the method needs
 recompile, perform the recompile if possible. 
 Complex blocks cannot always be automatically converted/recompiled.
 anArray must contain only SortedCollections.
 dict is used as a cache to canonicalize sort blocks with the same source
 string.

 Caller must handle and catch AlmostOutOfMemory errors and handle commits
 and aborts."

| sys sb eb errorBlock |
sb := Globals at:#SimpleBlock ifAbsent:[ (Globals at:#ObsoleteClasses) at: #SimpleBlock ] .
eb := ExecBlock .
sys := System .
errorBlock := [:_sys :_sc :_hsIdx|
                     _sys _add: _sc to: _hsIdx .
                     _sys _sessionCacheStatAt: 1 put: (sys _hiddenSetSize: _hsIdx) ].
1 to: anArray size do:[:n| | sc sortBlock val cls |
  sc := anArray at: n .
  sortBlock := sc sortBlock .
  cls := sortBlock class .
((cls ~~ eb) or: [sortBlock method needsRecompile]) ifTrue: [
   ((cls == sb) or: [sortBlock isSimple]) ifTrue:  [ | str |
      str := sortBlock _sourceString .
      val := dict at: str otherwise: nil .
      val ifNil:[ "A miss on the dictionary, compile it now"
            [ val := str evaluate ]  onSynchronous: CompileError
                                     do:[:ex | errorBlock value: sys value: sc value: hsIdx.
                                               val := nil.
                                               ex resume ] .
            val   "Now see if the recompile was successful"
              "Add to error list.  Probably already done."
              ifNil:[ errorBlock value: sys value: sc value: hsIdx ]
              ifNotNil:[ dict at: str put: val. "Add to cache"
                         sc _sortBlock: val]. "Store in instance"
      ] ifNotNil:[ sc _sortBlock: val ]. "A hit on the dictionary, store the block"
  ] 
  ifFalse: [ "needs conversion but cannot convert; complex block"
      errorBlock value: sys value: sc value: hsIdx ]. 
  ].
].
%


Last updated: 5/16/16