zwoop commented on code in PR #12782:
URL: https://github.com/apache/trafficserver/pull/12782#discussion_r3011963123
##########
src/proxy/http/HttpTransact.cc:
##########
@@ -3333,6 +3333,62 @@
HttpTransact::handle_cache_write_lock_go_to_origin_continue(State *s)
}
}
+///////////////////////////////////////////////////////////////////////////////
+// Name : handle_deferred_cache_write_complete
+// Description: Called after cache write opens for deferred cache write.
+// We already have the server response headers, so we continue
+// with cache write handling.
+//
+// Possible Next States From Here:
+// - handle_cache_operation_on_forward_server_response (if cache write
succeeded)
+// - handle_no_cache_operation_on_forward_server_response (if cache write
failed)
+//
+///////////////////////////////////////////////////////////////////////////////
+void
+HttpTransact::handle_deferred_cache_write_complete(State *s)
+{
+ TxnDbg(dbg_ctl_http_trans, "handle_deferred_cache_write_complete");
+ TxnDbg(dbg_ctl_http_seq, "Entering handle_deferred_cache_write_complete");
+
+ ink_assert(s->cache_info.action == CacheAction_t::PREPARE_TO_WRITE);
+
+ switch (s->cache_info.write_lock_state) {
+ case CacheWriteLock_t::SUCCESS:
+ // Cache write lock acquired successfully
+ TxnDbg(dbg_ctl_http_trans, "[hdcwc] cache write lock acquired");
+ SET_UNPREPARE_CACHE_ACTION(s->cache_info);
+ // Now we have WRITE action, handle the response with caching
+ handle_cache_operation_on_forward_server_response(s);
+ return;
+
+ case CacheWriteLock_t::FAIL:
+ // Could not get cache write lock, continue without caching
+ TxnDbg(dbg_ctl_http_trans, "[hdcwc] cache write lock failed, continuing
without cache");
+ Metrics::Counter::increment(http_rsb.cache_open_write_fail_count);
+ s->cache_info.action = CacheAction_t::NO_ACTION;
+ s->cache_info.write_status = CacheWriteStatus_t::LOCK_MISS;
+ break;
+
+ case CacheWriteLock_t::READ_RETRY:
+ // This shouldn't happen for deferred write since we don't have an object
to read
Review Comment:
If this shouldn't happen, should it be a InkAssert() at least ? Not sure
that TxnDbg is the right choice here either, maybe a notice or something else ?
--
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]