47 Object transferral
There is a CSpace locking mode that allows for transfer of all the objects from a child CSpace into the parent CSpace. We can extend this for PSpaces. This involves the following steps
- The extent of CSpace objects are all transferred as normal
- The child GCroots are cleared
- All DOS and ROT entries are transferred
It is then assumed that reparenting etc is performed so persistent objects are atomically moved from the child PSpace into the parent PSpace.
Issue : The transferral should be complete, in which case what happens to the set of roots recorded in the PSpace itself?
A interesting question is whether it is useful to support partial transfer of objects, and if so, how do we reliably transfer them. This is tricky because we need to think about
- Reparenting correctly and atomically
- Updating ROT's correctly
- Updating GCRoots correctly
- Updating GCObjects correctly
Selective object transferral for CSpaces
Consider that we can selectively move objects between CSpaces. To achieve this we could run a trace to find all the objects reachable from the object to be moved.
A downside of partial transferral is that we need to remove entries out of the GC extents. That is fairly fast if we build an independent copy.
Selective object transferral for PSpaces
There are some issues that make this a little tricky
- We have to perform the corresponding tranferral on the CSpace. Unfortunately a trace won't work if we avoid faulting objects in memory (important), and the objects in memory don't form a connected sub-tree. The latter is possible depending on the eviction strategy for persistent objects. It would be better to avoid assumptions!
- Transferral of entries from the ROT and DOS also needs idendification of what objects in memory belong to the tree being moved.
- What happens to the PSR?
A simpler, easier approach is to assumed that the entire child PSpace is implicitly being destroyed by the transfer.
IDEA: Consider that the LOCK_TRANSFER mode does the following:-
- It transfers everything out of the current CSpace, and into the parent CSpace
- The child CSpace is popped and destroyed.
This makes the parent space become the current space.