Skip to content
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

Availability: Adds nonblocking async lazy cache to improve upgrade scenarios #2822

Merged
merged 9 commits into from
Nov 4, 2021

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Oct 25, 2021

Pull Request Template

Description

The current AsyncCache on force refreshes removes the value. It then creates a new value and all incoming requests are stuck waiting for the new task to complete.

Issue
If a single replica moves only 1 of the 4 replica URIs are stale. The current async cache is blocking all requests until the value is updated. The 3 other replicas could be used to successfully complete requests.

Solution
AsyncCacheNonBlocking was created. This async cache does not block requests on refresh. It instead returns the stale value until the refresh is complete. Then the refresh value is used to update the cache. Any request using the forceRefresh to true will wait on the same refresh task.

Porting from internal PR: https://msdata.visualstudio.com/CosmosDB/_git/CosmosDB/pullrequest/648930

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #IssueNumber

ealsur
ealsur previously approved these changes Oct 25, 2021
@j82w j82w enabled auto-merge (squash) November 3, 2021 22:37
@j82w j82w merged commit e153e16 into master Nov 4, 2021
@j82w j82w deleted the users/jawilley/ha/asyncLazyCache branch November 4, 2021 14:06
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