@@ -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,9 @@ class CacheAllocator : public CacheBase {
16891718                                       WriteHandle newItemHdl,
16901719                                       const  Item& parent);
16911720
1721+   void  replaceChainedItemLockedForMoving (Item& oldItem,
1722+                                        WriteHandle& newItemHdl,
1723+                                        const  Item& parent);
16921724  //  Insert an item into MM container. The caller must hold a valid handle for
16931725  //  the item.
16941726  // 
@@ -1979,7 +2011,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
19792011          throw  std::runtime_error (" Not supported for chained items" 
19802012        }
19812013
1982-         if  (candidate->markMoving (true )) {
2014+         if  (candidate->markMoving ()) {
19832015          mmContainer.remove (itr);
19842016          candidates.push_back (candidate);
19852017        } else  {
@@ -2052,7 +2084,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
20522084
20532085        //  TODO: only allow it for read-only items?
20542086        //  or implement mvcc
2055-         if  (candidate->markMoving (true )) {
2087+         if  (candidate->markMoving ()) {
20562088          //  promotions should rarely fail since we already marked moving
20572089          mmContainer.remove (itr);
20582090          candidates.push_back (candidate);
0 commit comments