Skip to content

Fix writer starvation issue for compact mutex - #424

Merged
razdoburdin merged 5 commits into
mainfrom
dev/razdoburdin/compaction_starvation
Oct 22, 2026
Merged

razdoburdin merged 5 commits into
mainfrom
dev/razdoburdin/compaction_starvation

Conversation

@razdoburdin

Copy link
Copy Markdown
Member

This PR fixes potential writer starvation for compact_mutex by adding a gatekeeper.
Address one of the comments from: #418

@razdoburdin
razdoburdin removed the request for review from ahuber21 October 15, 2026 15:47

@rfsaliev rfsaliev 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.

LGFM

@razdoburdin
razdoburdin enabled auto-merge (squash) October 16, 2026 10:51
@razdoburdin
razdoburdin disabled auto-merge October 22, 2026 06:38
Comment thread include/svs/concurrent/dynamic_index.h Outdated
///
/// Hold this through internal-to-external ID translation. Acquire the translation
/// lock inside this guard, preserving the compact -> translator lock order.
[[nodiscard]] std::shared_lock<std::shared_mutex> lock_for_search() const {

@ahuber21 ahuber21 Oct 22, 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.

The naming is inconsistent. We're calling lock_for_search() but we are returning the gatekeeper lock. We're also using it for deletion and consolidation. So while I don't spot any logic issues, I'm pretty confused about the scope of the lock.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have renamed it to lock_storage_shared.
It doesn't return gatekeeper lock, but the shared compact_mutex_, that protects the storage during compaction. Gatekeeper is released just after the exit from lock_storage_shared.

@razdoburdin
razdoburdin merged commit d30c0ab into main Oct 22, 2026
22 checks passed
@razdoburdin
razdoburdin deleted the dev/razdoburdin/compaction_starvation branch October 22, 2026 14:05
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