Currently, we need to rely on the Transaction::read_set to ensure cache
residence of a leaf node until TransactionManager adds the logical
extent to the cache. The next patch, however, will introduce a lazy
flag for Transaction's to enable doing snapshot inconsistent scans
without populating the read_set, so we'll want this to work without
it.
Signed-off-by: Samuel Just <sjust@redhat.com>
CachedExtentRef extent);
void add_pin(LBAPin &pin) final {
- pin_set.add_pin(reinterpret_cast<BtreeLBAPin*>(&pin)->pin);
+ auto *bpin = reinterpret_cast<BtreeLBAPin*>(&pin);
+ pin_set.add_pin(bpin->pin);
+ bpin->parent = nullptr;
}
private:
class BtreeLBAPin : public LBAPin {
friend class BtreeLBAManager;
+
+ /**
+ * parent
+ *
+ * populated until link_extent is called to ensure cache residence
+ * until add_pin is called.
+ */
+ CachedExtentRef parent;
+
paddr_t paddr;
btree_range_pin_t pin;
BtreeLBAPin() = default;
BtreeLBAPin(
+ CachedExtentRef parent,
paddr_t paddr,
lba_node_meta_t &&meta)
- : paddr(paddr) {
+ : parent(parent), paddr(paddr) {
pin.set_range(std::move(meta));
}
auto begin = i->get_key();
ret.emplace_back(
std::make_unique<BtreeLBAPin>(
+ this,
val.paddr,
lba_node_meta_t{ begin, begin + val.len, 0}));
}
return insert_ret(
insert_ertr::ready_future_marker{},
std::make_unique<BtreeLBAPin>(
+ this,
val.paddr,
lba_node_meta_t{ begin, begin + val.len, 0}));
}