You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2022/04/28 23:04:52 UTC

[trafficserver] branch 9.2.x updated: Revert remap.config loading changes (#8803)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new 54f478fff Revert remap.config loading changes (#8803)
54f478fff is described below

commit 54f478fffe9ad69d05284910f4d95b5a4057c52b
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Thu Apr 28 18:04:44 2022 -0500

    Revert remap.config loading changes (#8803)
    
    Revert "Short circuit remap reload when a valid remap file is not specified (#7782)"
    
    This reverts commit d7847f23717d3a8be8341c244bbe1e27b2a6a77a.
    
    This is being reverted from 9.2.x because changing remap.config loading
    behavior was deemed too big a change to make within the 9.x releases.
    See the discussion in #8802. These remap.config changes will be pursued
    in the 10.x train.
    
    Co-authored-by: bneradt <bn...@yahooinc.com>
---
 proxy/ReverseProxy.cc           |  5 ++---
 proxy/http/remap/RemapConfig.cc | 12 +++++++++---
 proxy/http/remap/UrlRewrite.cc  |  6 ++----
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc
index c04f6cdfb..f46955812 100644
--- a/proxy/ReverseProxy.cc
+++ b/proxy/ReverseProxy.cc
@@ -67,10 +67,9 @@ init_reverse_proxy()
 
   Note("%s loading ...", ts::filename::REMAP);
   if (!rewrite_table->load()) {
-    Warning("%s failed to load", ts::filename::REMAP);
-  } else {
-    Note("%s finished loading", ts::filename::REMAP);
+    Fatal("%s failed to load", ts::filename::REMAP);
   }
+  Note("%s finished loading", ts::filename::REMAP);
 
   REC_RegisterConfigUpdateFunc("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED);
   REC_RegisterConfigUpdateFunc("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED);
diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index 61afbd702..5a2930aec 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -944,9 +944,15 @@ remap_parse_config_bti(const char *path, BUILD_TABLE_INFO *bti)
 
   std::error_code ec;
   std::string content{ts::file::load(ts::file::path{path}, ec)};
-  if (ec.value()) {
-    Warning("Failed to open remapping configuration file %s - %s", path, strerror(ec.value()));
-    return false;
+  if (ec) {
+    switch (ec.value()) {
+    case ENOENT:
+      Warning("Can't open remapping configuration file %s - %s", path, strerror(ec.value()));
+      break;
+    default:
+      Error("Failed load remapping configuration file %s - %s", path, strerror(ec.value()));
+      return false;
+    }
   }
 
   Debug("url_rewrite", "[BuildTable] UrlRewrite::BuildTable()");
diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc
index 96de22b3a..e8ca255e0 100644
--- a/proxy/http/remap/UrlRewrite.cc
+++ b/proxy/http/remap/UrlRewrite.cc
@@ -698,11 +698,9 @@ UrlRewrite::BuildTable(const char *path)
   temporary_redirects.hash_lookup.reset(new URLTable);
   forward_mappings_with_recv_port.hash_lookup.reset(new URLTable);
 
-  int zret = 0;
-
   if (!remap_parse_config(path, this)) {
     // XXX handle file reload error
-    zret = 3;
+    return 3;
   }
 
   // Destroy unused tables
@@ -730,7 +728,7 @@ UrlRewrite::BuildTable(const char *path)
     forward_mappings_with_recv_port.hash_lookup.reset(nullptr);
   }
 
-  return zret;
+  return 0;
 }
 
 /**