Skip to content

Commit

Permalink
Fix the wbcache dependency chain issue. (#291)
Browse files Browse the repository at this point in the history
Add the dependency to any dirty buffer which has modification.
Either left or parent can be modified, add to the end of it.
  • Loading branch information
sanebay authored Jan 26, 2024
1 parent a7a22c2 commit 64600e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "5.0.5"
version = "5.0.6"
homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
topics = ("ebay", "nublox")
Expand Down
7 changes: 5 additions & 2 deletions src/lib/index/wb_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,26 @@ std::pair< bool, bool > IndexWBCache::create_chain(IndexBufferPtr& second, Index
auto old_third = third;
if (!second->is_clean()) {
auto new_second = copy_buffer(second, cp_ctx);
chain = second;
second = new_second;
second_copied = true;
}

if (!third->is_clean()) {
auto new_third = copy_buffer(third, cp_ctx);
chain = third;
third = new_third;
third_copied = true;
}

// Append parent(third) to the left child(second).
second->m_next_buffer = third;
third->m_wait_for_leaders.increment(1);
if (chain != second) {
if (second_copied || third_copied) {
// We want buffers to be append to the end of the chain which are related.
// If we split a node multiple times in same or different CP's, each dirty buffer will be
// added to the end of that chain.
// added to the end of that chain. Whichever dependent buffer is dirty, we add this
// parent-left combination to the end of that chain.
while (chain->m_next_buffer.lock() != nullptr) {
chain = chain->m_next_buffer.lock();
}
Expand Down

0 comments on commit 64600e9

Please sign in to comment.