serrislew commented on code in PR #12408:
URL: https://github.com/apache/trafficserver/pull/12408#discussion_r2270665224


##########
plugins/slice/server.cc:
##########
@@ -445,60 +457,30 @@ handleNextServerHeader(Data *const data)
   }
 
   // Header mismatch
-  if (same) {
-    // If we were in reference block refetch mode and the headers
-    // still match there is a problem
-    if (BlockState::ActiveRef == data->m_blockstate) {
-      ERROR_LOG("Reference block refetched, got the same block back again");
-      return false;
-    }
-  } else {
-    switch (data->m_blockstate) {
-    case BlockState::Active: {
+  if (!same) {
+    if (data->m_blockstate == BlockState::Active) {
       data->m_upstream.abort();
 
-      // Refetch the current interior slice
-      data->m_blockstate = BlockState::PendingInt;
-
-      time_t date = 0;
-      header.timeForKey(TS_MIME_FIELD_DATE, TS_MIME_LEN_DATE, &date);
-
-      // Ask for any slice newer than the cached one
-      time_t const dateims = date + 1;
-
-      DEBUG_LOG("Attempting to reissue interior slice block request with IMS 
header time: %jd", static_cast<intmax_t>(dateims));
-
-      // add special CRR IMS header to the request
-      HttpHeader          headerreq(data->m_req_hdrmgr.m_buffer, 
data->m_req_hdrmgr.m_lochdr);
-      Config const *const conf = data->m_config;
-      if (!headerreq.setKeyTime(conf->m_crr_ims_header.data(), 
conf->m_crr_ims_header.size(), dateims)) {
-        ERROR_LOG("Failed setting '%s'", conf->m_crr_ims_header.c_str());
-        return false;
-      }
-
-    } break;
-    case BlockState::ActiveInt: {
-      data->m_upstream.abort();
+      DEBUG_LOG("Starting refetch of reference block");
 
-      // New interior slice still mismatches, refetch the reference slice
+      // Interior slice doesn't match reference slice, refetch reference
+      // In this case we've given up but are trying to fix the reference
+      // for next time
       data->m_blockstate = BlockState::PendingRef;
 
-      // convert reference date header to time_t
-      time_t const date = TSMimeParseDate(data->m_date, data->m_datelen);
-
-      // Ask for any slice newer than the cached one
-      time_t const dateims = date + 1;
-
-      DEBUG_LOG("Attempting to reissue reference slice block request with IMS 
header time: %jd", static_cast<intmax_t>(dateims));
-
-      // add special CRR IMS header to the request
-      HttpHeader          headerreq(data->m_req_hdrmgr.m_buffer, 
data->m_req_hdrmgr.m_lochdr);
-      Config const *const conf = data->m_config;
-      if (!headerreq.setKeyTime(conf->m_crr_ims_header.data(), 
conf->m_crr_ims_header.size(), dateims)) {
-        ERROR_LOG("Failed setting '%s'", conf->m_crr_ims_header.c_str());
-        return false;
+      // interior headers for new identifier reference
+      data->m_etaglen = etaglen;
+      if (0 < etaglen) {
+        strncpy(data->m_etag, etag, etaglen);
+      }
+      data->m_lastmodifiedlen = lastmodifiedlen;
+      if (0 < lastmodifiedlen) {
+        strncpy(data->m_lastmodified, lastmodified, lastmodifiedlen);
       }
 
+      // potentially new content length
+      data->m_contentlen = blockcr.m_length;
+
       // Reset for first block
       if (Config::RefType::First == data->m_config->m_reftype) {

Review Comment:
   so now when we see a mismatch with the ref, we set the tags to CRR and 
refetch ref slice. What is the difference between Active and ActiveInt before? 
should we be resetting for the first block on the Active state? isn't that 
processing the current block? does this stop all subsequent requests?



-- 
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: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to