@@ -1544,6 +1544,25 @@ class CacheAllocator : public CacheBase {
1544
1544
WriteHandle allocateChainedItemInternal (const ReadHandle& parent,
1545
1545
uint32_t size);
1546
1546
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
+
1547
1566
// Given an item and its parentKey, validate that the parentKey
1548
1567
// corresponds to an item that's the parent of the supplied item.
1549
1568
//
@@ -1620,6 +1639,16 @@ class CacheAllocator : public CacheBase {
1620
1639
// @return true If the move was completed, and the containers were updated
1621
1640
// successfully.
1622
1641
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);
1623
1652
1624
1653
// Moves a regular item to a different slab. This should only be used during
1625
1654
// slab release after the item's exclusive bit has been set. The user supplied
@@ -1689,6 +1718,24 @@ class CacheAllocator : public CacheBase {
1689
1718
WriteHandle newItemHdl,
1690
1719
const Item& parent);
1691
1720
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);
1692
1739
// Insert an item into MM container. The caller must hold a valid handle for
1693
1740
// the item.
1694
1741
//
@@ -1979,7 +2026,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
1979
2026
throw std::runtime_error (" Not supported for chained items" );
1980
2027
}
1981
2028
1982
- if (candidate->markMoving (true )) {
2029
+ if (candidate->markMoving ()) {
1983
2030
mmContainer.remove (itr);
1984
2031
candidates.push_back (candidate);
1985
2032
} else {
@@ -2052,7 +2099,7 @@ auto& mmContainer = getMMContainer(tid, pid, cid);
2052
2099
2053
2100
// TODO: only allow it for read-only items?
2054
2101
// or implement mvcc
2055
- if (candidate->markMoving (true )) {
2102
+ if (candidate->markMoving ()) {
2056
2103
// promotions should rarely fail since we already marked moving
2057
2104
mmContainer.remove (itr);
2058
2105
candidates.push_back (candidate);
0 commit comments