Skip to content

CBG-4734: fix for race when removing a value that is being loaded into rev cache #7640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 1, 2025

Conversation

gregns1
Copy link
Contributor

@gregns1 gregns1 commented Jul 22, 2025

CBG-4734

Added a new function to remove only from rev lookup and have extra logic around eviction to enure we are evicting values we should be

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

@Copilot Copilot AI review requested due to automatic review settings July 22, 2025 11:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes a race condition in the revision cache where an item being evicted could still be in the process of loading from the bucket. The solution adds retry loops that wait for the canEvict atomic boolean to be true before proceeding with cache removal operations.

  • Adds retry loops in both removeFromCacheByCV and removeFromCacheByRev methods to wait for items to finish loading
  • Uses atomic boolean check on elem.canEvict to determine when it's safe to evict an item

@gregns1 gregns1 self-assigned this Jul 25, 2025
Copy link
Member

@bbrks bbrks left a comment

Choose a reason for hiding this comment

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

LGTM

@gregns1 gregns1 merged commit 6ed9ceb into main Aug 1, 2025
44 checks passed
@gregns1 gregns1 deleted the CBG-4734 branch August 1, 2025 13:44
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