ezelkow1 commented on code in PR #12852:
URL: https://github.com/apache/trafficserver/pull/12852#discussion_r2770305453
##########
src/proxy/http/HttpTransact.cc:
##########
@@ -3271,20 +3384,50 @@ HttpTransact::HandleCacheOpenReadMiss(State *s)
} else if (s->api_server_response_no_store) { // plugin may have decided not
to cache the response
s->cache_info.action = CacheAction_t::NO_ACTION;
} else if (s->cache_info.write_lock_state == CacheWriteLock_t::READ_RETRY) {
- // We've looped back around due to failing to read during READ_RETRY mode.
- // Don't attempt another cache write - just proxy to origin without
caching.
+ // READ_RETRY cache read failed (no object found). If there was a stale
object,
+ // handle_cache_write_lock would have called HandleCacheOpenReadHit, not
us.
+ // Don't attempt cache write - just proxy to origin without caching.
TxnDbg(dbg_ctl_http_trans, "READ_RETRY cache read failed, bypassing
cache");
s->cache_info.action = CacheAction_t::NO_ACTION;
} else {
HttpTransact::set_cache_prepare_write_action_for_new_request(s);
}
- ///////////////////////////////////////////////////////////////
- // a normal miss would try to fetch the document from the //
- // origin server, unless the origin server isn't resolvable, //
- // but if "CacheControl: only-if-cached" is set, then we are //
- // supposed to send a 504 (GATEWAY TIMEOUT) response. //
- ///////////////////////////////////////////////////////////////
+ // If the CACHE_LOOKUP_COMPLETE hook was deferred, decide whether to fire it
now.
+ // Only fire when we're at a terminal state for cache lookup:
+ // - NO_ACTION: Not attempting write lock, MISS is the final result
+ // - READ_RETRY: Already retried and still missed, MISS is the final result
+ //
+ // Don't fire yet if action == PREPARE_TO_WRITE and write_lock_state !=
READ_RETRY,
+ // because we're about to attempt the write lock and may find content on
retry.
+ // In that case, the hook will fire later:
+ // - If READ_RETRY finds HIT: HandleCacheOpenReadHitFreshness fires with HIT
Review Comment:
I will add
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]