Add fixes around fail_action 5 #12845
Open
+462
−0
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.
This adds some fixes around fail_action 5. First it prevents a possible looping scenario, previously after exhausting waiting for a read lock after having failed in a write lock it would loop back around to check for write again. Now it will just go to origin. While this allows an extra request through it can prevent some odd scenarios, including one where it just writes back to the cache again anyway which would already be useless. Also if the original rww request is very slow then this allows waiters to bypass it.
Second there could be an issue around redirects, normally a redirect is fine since it would have a different cachekey but if we enable use_orig then we could end up in the same looping contention in that scenario as well.
Also adds some autests, though we should keep an eye on these since they could be timing dependent. So if we start getting failures we can turn them off.