Copilot commented on code in PR #13611:
URL: https://github.com/apache/trafficserver/pull/13611#discussion_r4016566996


##########
src/proxy/http/HttpTransact.cc:
##########
@@ -2724,6 +2724,22 @@ HttpTransact::HandleCacheOpenReadHitFreshness(State *s)
     s->cache_lookup_result = HttpTransact::CacheLookupResult_t::HIT_STALE;
   }
 
+  // An object found under the 9.2 key cannot be revalidated: the write that
+  // would apply a 304 is a create on the current key, not an update of the
+  // legacy vector, so the cache discards it. Treat a stale one as a miss. The
+  // full response then lands under the current key through the ordinary miss
+  // path and the legacy copy ages out. Only reads migrate; the methods that
+  // invalidate take the delete path, which reaches both keys.
+  if (s->cache_lookup_result == HttpTransact::CacheLookupResult_t::HIT_STALE 
&& s->state_machine != nullptr &&
+      CompatCacheKey::is_legacy(s->state_machine->compatibility_cache_lookup) 
&&
+      (s->method == HTTP_WKSIDX_GET || s->method == HTTP_WKSIDX_HEAD)) {
+    TxnDbg(dbg_ctl_http_seq, "Stale under the compatibility key, treating as a 
miss");
+    s->cache_info.object_read         = nullptr;

Review Comment:
   This branch changes the legacy hit to MISS but does not clear request 
conditionals. `HandleCacheOpenReadMissGoToOrigin()` later calls 
`build_request()`, which copies client `If-None-Match` / `If-Modified-Since`; 
removal there is conditional on cacheability and `cache_when_to_revalidate`, so 
a configuration such as `cache_when_to_revalidate == 4` can still send them 
upstream. A 304 then reaches the canonical create without a full response and 
the migration is lost. Strip conditional headers unconditionally for this 
legacy-stale path after the outbound request is built, using 
`HttpTransactHeaders::remove_conditional_headers`.



-- 
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]

Reply via email to