Do not write to the cache if the plugin decides not to write#7461
Merged
vmamidi merged 1 commit intoapache:masterfrom Feb 2, 2021
Merged
Do not write to the cache if the plugin decides not to write#7461vmamidi merged 1 commit intoapache:masterfrom
vmamidi merged 1 commit intoapache:masterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TSHttpTxnServerRespNoStoreSet can be called after READ_REQUEST_HDR state. For example, cache promotes plugin calls this at TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE hook.
Checking the api_server_response_no_store flag after receiving the origin server response could create a race condition when a request that is not chosen to update the cache by cache promote plugin is holding the lock.
request1---holds the locks( not chosen to write to cache)---request2---fails to acquire the lock(selected to write to cache)
This causes both the requests to not write to cache.
Checking for the flag api_server_response_no_store before moving into the CACHE_ISSUE_WRITE state avoids the cache write lock and avoids the race.