@@ -1544,6 +1544,25 @@ class CacheAllocator : public CacheBase {
15441544  WriteHandle allocateChainedItemInternal (const  ReadHandle& parent,
15451545                                          uint32_t  size);
15461546
1547+   //  Allocate a chained item to a specific tier
1548+   // 
1549+   //  The resulting chained item does not have a parent item and
1550+   //  will be freed once the handle is dropped
1551+   // 
1552+   //  The parent handle parameter here is mainly used to find the
1553+   //  correct pool to allocate memory for this chained item
1554+   // 
1555+   //  @param parent    handle to the cache item
1556+   //  @param size      the size for the chained allocation
1557+   //  @param tid       the tier to allocate on
1558+   // 
1559+   //  @return    handle to the chained allocation
1560+   //  @throw     std::invalid_argument if the size requested is invalid or
1561+   //             if the item is invalid
1562+   WriteHandle allocateChainedItemInternalTier (const  ReadHandle& parent,
1563+                                           uint32_t  size,
1564+                                           TierId tid);
1565+ 
15471566  //  Given an item and its parentKey, validate that the parentKey
15481567  //  corresponds to an item that's the parent of the supplied item.
15491568  // 
@@ -1620,6 +1639,16 @@ class CacheAllocator : public CacheBase {
16201639  //  @return true  If the move was completed, and the containers were updated
16211640  //                successfully.
16221641  bool  moveRegularItemWithSync (Item& oldItem, WriteHandle& newItemHdl);
1642+   
1643+   //  Moves a chained item to a different memory tier.
1644+   // 
1645+   //  @param oldItem     Reference to the item being moved
1646+   //  @param newItemHdl  Reference to the handle of the new item being moved into
1647+   //  @param parentHandle Reference to the handle of the parent item
1648+   // 
1649+   //  @return true  If the move was completed, and the containers were updated
1650+   //                successfully.
1651+   bool  moveChainedItemWithSync (ChainedItem& oldItem, WriteHandle& newItemHdl, WriteHandle& parentHandle);
16231652
16241653  //  Moves a regular item to a different slab. This should only be used during
16251654  //  slab release after the item's exclusive bit has been set. The user supplied
@@ -1689,6 +1718,24 @@ class CacheAllocator : public CacheBase {
16891718                                       WriteHandle newItemHdl,
16901719                                       const  Item& parent);
16911720
1721+   void  replaceChainedItemLockedForMoving (Item& oldItem,
1722+                                        WriteHandle& newItemHdl,
1723+                                        const  Item& parent);
1724+   
1725+   //  
1726+   //  Performs the actual inplace replace - it is called from
1727+   //  replaceChainedItemLockedForMoving and replaceChainedItemLocked
1728+   //  must hold chainedItemLock
1729+   // 
1730+   //  @param oldItem  the item we are replacing in the chain
1731+   //  @param newItem  the item we are replacing it with
1732+   //  @param parent   the parent for the chain
1733+   // 
1734+   //  @return handle to the oldItem
1735+   void  replaceInChainLocked (Item& oldItem,
1736+                             WriteHandle& newItemHdl,
1737+                             const  Item& parent,
1738+                             bool  fromMoving);
16921739  //  Insert an item into MM container. The caller must hold a valid handle for
16931740  //  the item.
16941741  // 
@@ -1979,7 +2026,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
19792026          throw  std::runtime_error (" Not supported for chained items" 
19802027        }
19812028
1982-         if  (candidate->markMoving (true )) {
2029+         if  (candidate->markMoving ()) {
19832030          mmContainer.remove (itr);
19842031          candidates.push_back (candidate);
19852032        } else  {
@@ -2052,7 +2099,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
20522099
20532100        //  TODO: only allow it for read-only items?
20542101        //  or implement mvcc
2055-         if  (candidate->markMoving (true )) {
2102+         if  (candidate->markMoving ()) {
20562103          //  promotions should rarely fail since we already marked moving
20572104          mmContainer.remove (itr);
20582105          candidates.push_back (candidate);
0 commit comments