Skip to content

Conversation

@sanebay
Copy link
Contributor

@sanebay sanebay commented Oct 31, 2025

During replay nublocks needs to check if blks are alloced and call free_blk_now to directly free the blks from bitmap cache and not depend on cp flush.

During replay nublocks needs to check if blks are alloced
and call free_blk_now to directly free the blks from
bitmap cache and not depend on cp flush.
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 36.84211% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.71%. Comparing base (1a0cef8) to head (4692302).
⚠️ Report is 303 commits behind head on master.

Files with missing lines Patch % Lines
src/lib/blkdata_svc/blkdata_service.cpp 0.00% 11 Missing ⚠️
src/lib/device/virtual_dev.cpp 85.71% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #826       +/-   ##
===========================================
+ Coverage   56.51%   66.71%   +10.20%     
===========================================
  Files         108      110        +2     
  Lines       10300    13067     +2767     
  Branches     1402     1897      +495     
===========================================
+ Hits         5821     8718     +2897     
+ Misses       3894     3350      -544     
- Partials      585      999      +414     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


BLKALLOC_REL_ASSERT(old_alloc_list_ptr == nullptr, "Multiple acquires concurrently?");
return (m_disk_bm->serialize(m_align_size));
return (m_disk_bm->serialize(m_align_size, true));
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't reuse the serialized buffer here, it will also impact normal IO load, right?
Can we only set this to true for recovery path, in which it will only impact the log replay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesnt normal IO path. Its only during CP flush. I tried to do using is_intialized, but it still crashes with CRC error. so keeping copy for now.
bool force_copy = hs()->is_initializing() ? true : false;
return (m_disk_bm->serialize(m_align_size, force_copy));

return f;
}

std::error_code BlkDataService::free_blk_now(MultiBlkId const& bids) {
Copy link
Contributor

@yamingk yamingk Nov 3, 2025

Choose a reason for hiding this comment

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

Using a new API is okay, I am thinking do we want to re-use async_free_blk and pass additional parameter is_recovery which is defaulted to false, and set to true during log_replay, and in async_free_blk, if is_recovery is true, we call m_vdev->free_blk(bids, nullptr /cp_ctx/); and this should fix the issue, right?

in vdev::free_blk, if ctx is nullptr, it will go ahead to varsize blkallocator and just free the blk from both cache and bitmap, same as this new API is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally the logic of is_recovery is internal to homestore, so we shouldnt expose it outside.

Copy link
Contributor

Choose a reason for hiding this comment

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

not necessary the case the we shouldn't expose recovery to HomeBlks. We are exposing recovery logic to HomeObject and HomeBlks already, in recovery path, we do different code path and we have recovery callback for HomeBlocks and HomeObjects to recovery PGs, volumes, etc.

return std::make_error_code(std::errc::resource_unavailable_try_again);
} else {
auto cpg = hs()->cp_mgr().cp_guard();
m_vdev->free_blk(bids, s_cast< VDevCPContext* >(cpg.context(cp_consumer_t::BLK_DATA_SVC)), true /* free_now */);
Copy link
Contributor

@yamingk yamingk Nov 3, 2025

Choose a reason for hiding this comment

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

If we want a new API instead of re-use async_free_blk, which is also fine, could we set cp_ctx to nullptr without taking the cp_guard, it should do the work as it is for m_vdev->free_blk, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cp_guard was kept for safety, so that it wont add to current CP, if its has already started. During recovery, CP's will be running.

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.

3 participants