Skip to content

SDSTOR-24093: Duplicate inserts in wb_cache - #902

Merged
nnastonen merged 2 commits into
eBay:stable/v7.xfrom
nnastonen:SDSTOR-24093_wbc_dublicate_inserts
Aug 10, 2026
Merged

SDSTOR-24093: Duplicate inserts in wb_cache#902
nnastonen merged 2 commits into
eBay:stable/v7.xfrom
nnastonen:SDSTOR-24093_wbc_dublicate_inserts

Conversation

@nnastonen

Copy link
Copy Markdown
Contributor

Fix for "Duplicate inserts in wb_cache" bug.

In async_cp_flush(), m_vdev->cp_flush() is called only for cp_ctx->id() == 0.

That design misses the case where recovery repaired allocator state but left no dirty index buffers.

@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (stable/v7.x@0bdc47f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/lib/index/wb_cache.cpp 50.00% 0 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@              Coverage Diff               @@
##             stable/v7.x     #902   +/-   ##
==============================================
  Coverage               ?   48.41%           
==============================================
  Files                  ?      110           
  Lines                  ?    12984           
  Branches               ?     6239           
==============================================
  Hits                   ?     6286           
  Misses                 ?     2546           
  Partials               ?     4152           

☔ View full report in Codecov by Harness.
📢 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.

@JacksonYao287 JacksonYao287 left a comment

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.

thanks @nnastonen for this PR, the RCA looks good to me. I have several comments.

1 pls bump conan version.

2 this PR only handles the blk_commit case, but not handle the blk_free case, which also need to be persisted by vdev->cp_flush. so , my suggeesion is if there is any blk_commit or blk_free in a cp, we need to call vdev->cp_flush in index cp_flush. actually , if there is any blk_commit or free in a cp, we need to trigger vdev->cp_flush, no matter the dirty list is empty

3 it is better to have a UT for this fix.

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.

@JacksonYao287

Copy link
Copy Markdown
Member

@nnastonen thank you for the update, the changes looks good to me.
before merging, pls also update conan version in conan.py from 7.5.15 to 7.5.16 , otherwise the check version work follow will fail.

@shosseinimotlagh do you have any input?

@nnastonen
nnastonen force-pushed the SDSTOR-24093_wbc_dublicate_inserts branch from 96c05ec to 0c2ee4b Compare August 10, 2026 10:10

@JacksonYao287 JacksonYao287 left a comment

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.

LGTM

@nnastonen
nnastonen merged commit 0d15abb into eBay:stable/v7.x Aug 10, 2026
21 checks passed
@shosseinimotlagh

Copy link
Copy Markdown
Contributor

This PR looks good to me! Thank you Niko for addressing it and thank you Jie to review it

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.

4 participants