Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "7.5.15"
version = "7.5.16"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
19 changes: 9 additions & 10 deletions src/lib/index/wb_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ void IndexWBCache::recover(sisl::byte_view sb) {
was_node_committed(buf->m_up_buffer));
buf->m_node_freed = false;
r_cast< persistent_hdr_t* >(buf->m_bytes)->node_deleted = false;
m_vdev->commit_blk(buf->m_blkid);
auto alloc_status = m_vdev->commit_blk(buf->m_blkid);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would suggest to add a HS_REL_ASSERT(alloc_status == BlkAllocStatus::SUCCESS) to not ignore any failure when committing blk, since it will be dangerous to go ahead with an uncommitted blk here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before this PR the result of m_vdev->commit_blk() was ignored and with the flow covered by this PR, unsuccessful status will not trigger the flush. I think fixing the error-path is a different concern and should be documented and implemented separately.

@JacksonYao287 JacksonYao287 Aug 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sure。 I am still thinking that since vdev->cp_flush is very light-weight, and for those non-dirtied blk_allocator , it`s no-op.

so, I think it will be simpler for this PR to always call m_vdev->cp_flush() in async_cp_flush(no need to check allocator_state_changed)(even if cp_ctx->id() is not zero when there is not any dirty buffer). it will be just several line changes and can cover all cases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed.

HS_REL_ASSERT_EQ(alloc_status, BlkAllocStatus::SUCCESS, "Unsuccessful commit_blk() in recover()");
if (buf->m_node_level) { potential_parent_recovered_bufs.insert(buf); }
prune_from_up_buffer(buf);
}
Expand All @@ -668,7 +669,8 @@ void IndexWBCache::recover(sisl::byte_view sb) {
// Both current and up buffer is committed, we can safely commit the current block
LOGTRACEMOD(wbcache, "New buffer {} and the up buffer {} are committed", buf->to_string(),
buf->m_up_buffer->to_string());
m_vdev->commit_blk(buf->m_blkid);
auto alloc_status = m_vdev->commit_blk(buf->m_blkid);
HS_REL_ASSERT_EQ(alloc_status, BlkAllocStatus::SUCCESS, "Unsuccessful commit_blk() in recover()");
pending_bufs.push_back(buf->m_up_buffer);
} else {
// Up buffer is not committed, we need to repair it first
Expand Down Expand Up @@ -847,14 +849,11 @@ folly::Future< bool > IndexWBCache::async_cp_flush(IndexCPContext* cp_ctx) {
// cp_ctx->to_string_dot(filename);
// #endif
if (!cp_ctx->any_dirty_buffers()) {
if (cp_ctx->id() == 0) {
// For the first CP, we need to flush the journal buffer to the meta blk
LOGINFO("First time boot cp, we shall flush the vdev to ensure all cp information is created");
m_vdev->cp_flush(cp_ctx);
} else {
CP_PERIODIC_LOG(DEBUG, unmove(cp_ctx->id()), "Btree does not have any dirty buffers to flush");
}
cp_ctx->complete(true);
LOGINFO("Flush the vdev to ensure all cp information is created");
// Always try to flush, will be a no-op when not needed
m_vdev->cp_flush(cp_ctx);

cp_ctx->complete(true);
return folly::makeFuture< bool >(true); // nothing to flush
}

Expand Down
Loading