bneradt commented on code in PR #12988:
URL: https://github.com/apache/trafficserver/pull/12988#discussion_r2961601188


##########
src/proxy/ReverseProxy.cc:
##########
@@ -82,14 +85,21 @@ init_reverse_proxy()
                                                          
{"proxy.config.url_remap.filename",               // trigger records
                                                           
"proxy.config.proxy_name", "proxy.config.http.referer_default_redirect"});
 
-  rewrite_table.load()->acquire();
+  initial_table->acquire();
   Note("%s loading ...", ts::filename::REMAP);
-  if (!rewrite_table.load()->load()) {
+  if (!initial_table->load()) {
     Emergency("%s failed to load", ts::filename::REMAP);
   } else {
     Note("%s finished loading", ts::filename::REMAP);
   }
 
+  if (initial_table->is_valid() && CacheProcessor::IsCacheEnabled() == 
CacheInitState::INITIALIZED) {
+    // Initialize deferred @volume= mappings before publishing so startup-only
+    // remap walks cannot race a reload.
+    init_table_volume_host_records(*initial_table);
+  }
+
+  rewrite_table.store(initial_table, std::memory_order_release);
   RecRegisterConfigUpdateCb("proxy.config.reverse_proxy.enabled", 
url_rewrite_CB, (void *)REVERSE_CHANGED);

Review Comment:
   Good catch. I kept the early register_config("remap", ...) call because 
remap has to be registered before load() so .include children are tracked 
correctly, but I changed it to register without trigger records and only attach 
the reload-trigger callbacks after rewrite_table is published. I also gated the 
deferred @volume= post-cache-init pass on CacheInitState::INITIALIZED, which 
keeps the cache-volume startup path clean when cache init finishes in FAILED.



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