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


##########
src/iocore/cache/RamCacheCLFUS.cc:
##########
@@ -880,13 +932,19 @@ RamCacheCLFUS::put(CryptoHash *key, IOBufferData *data, 
uint32_t len, bool copy,
     victim_value += cache_value(victim);
     this->_tick();
     if (!e) {
-      goto Lhistory;
+      if (!seen_match) {
+        goto Lhistory;
+      }
+      if (this->_bytes + victim->size + size > this->_max_bytes && 
victim_value > cache_value_hits_size(1, size)) {

Review Comment:
   The new seen-matched admission path can exceed `_max_bytes` because its fit 
checks omit entry metadata. With nonempty history, three 8 KiB residents in a 
32 KiB cache, and a 7,424-byte copy-in candidate, this check lets admission 
proceed despite a more valuable victim; `Linsert` then restores the victim and 
raises `_bytes` to 33,024. Include the candidate's `entry_overhead` in 
admission fit checks and both entries' overhead in victim-restoration checks, 
and add a near-capacity regression.



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