Skip to content

Fix race in pin/unpin#38

Merged
DwyaneShi merged 1 commit into
aibrix:devfrom
yapple:fix-race
Mar 20, 2026
Merged

Fix race in pin/unpin#38
DwyaneShi merged 1 commit into
aibrix:devfrom
yapple:fix-race

Conversation

@yapple

@yapple yapple commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

[Please provide a clear and concise description of your changes here]

Related Issues

Resolves: #[Insert issue number(s)]

Important: Before submitting, please complete the description above and review the checklist below.


Contribution Guidelines (Expand for Details)

We appreciate your contribution to PrisKV! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:

Pull Request Title Format

Your PR title should start with one of these prefixes to indicate the nature of the change:

  • [Bug]: Corrections to existing functionality
  • [CI]: Changes to build process or CI pipeline
  • [Docs]: Updates or additions to documentation
  • [API]: Modifications to PrisKV's API or interface
  • [CLI]: Changes or additions to the Command Line Interface
  • [Misc]: For changes not covered above (use sparingly)

Note: For changes spanning multiple categories, use multiple prefixes in order of importance.

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

@yapple yapple force-pushed the fix-race branch 3 times, most recently from cb3e88b to c98fcb5 Compare March 12, 2026 08:09
Comment thread server/transport/transport.c
Comment thread server/transport/transport.c
  • Add priskv_publish_node_with_pin(kv, keynode, pin_on_publish) and make priskv_publish_node delegate to it. Publishing now runs under the hash-bucket lock, inherits pin_count from the old version, removes the old visible node, inserts the new one, and cleans up the old outside the lock—ensuring a single visible version.
  • Replace deprecated priskv_key_pin with priskv_key_pin_latest; update semantics so both pin and unpin operate on the latest visible version under the bucket lock, with inline expiry cleanup on miss/expired.
  • Transport SEAL now calls priskv_publish_node_with_pin to remove the publish→pin race; ACQUIRE uses priskv_key_pin_latest; RELEASE uses priskv_key_unpin_latest.
  • Add concurrency tests (two-thread and stress) to verify single-version visibility and pin_count inheritance; extend negative/permission and failure-path coverage.
@DwyaneShi

Copy link
Copy Markdown
Collaborator

LGTM. Comment refinement will be done in #40 . Merge it for now.

@DwyaneShi DwyaneShi merged commit 500a8db into aibrix:dev Mar 20, 2026
2 checks passed
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.

2 participants