Skip to content

Conversation

@raakella1
Copy link
Contributor

Add UTs to
Trigger cache eviction in a multi threaded test
Range remove crash recovery

const auto& hnode = (sisl::SingleEntryHashNode< BtreeNodePtr >&)rec;
return static_cast< IndexBtreeNode* >(hnode.m_value.get())->m_idx_buf->is_clean();
auto idx_buf = static_cast< IndexBtreeNode* >(hnode.m_value.get())->m_idx_buf;
return !idx_buf || idx_buf->is_clean();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you share under which use case idx_buf will be nulllptr?
Shouldn't cache always be the last one to free this buf when evicted?
I think what we need here is probably an debug assert that idx_buf is not nullptr? Or is there a case that I am not aware of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache is a little different to 1.3. Here, the cache holds a shared ptr to the btree node and the index buffer is a member of the btree node. The idx buffer of a btree node can be freed or copied into a new buffer and the previous idx buffer can become invalid

Copy link
Contributor

@yamingk yamingk Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy to a new buffer is okay as long as it is still valid. When (and who) will free a btree nodes's index buffer with a cache record still pointing to this node?
Would you also help me understand in which case we need to copy a index buffer and invalidate the original idx buff?

@raakella1 raakella1 force-pushed the btree_uts branch 2 times, most recently from 571e6f7 to adb670f Compare September 30, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants