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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
     new 13b45c813c s3_auth does not retry after a file read error (#11864) 
(#11892)
13b45c813c is described below

commit 13b45c813c14cfd500bbde6c1228e0d8d5be4757
Author: Jasmine Emanouel <[email protected]>
AuthorDate: Fri Dec 6 03:05:36 2024 +1100

    s3_auth does not retry after a file read error (#11864) (#11892)
    
    * Update origin_server_auth.cc
    
    * Add cmath include
    
    * Update documentation
---
 doc/admin-guide/plugins/s3_auth.en.rst |  8 ++++++++
 plugins/s3_auth/s3_auth.cc             | 18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/doc/admin-guide/plugins/s3_auth.en.rst 
b/doc/admin-guide/plugins/s3_auth.en.rst
index 87f1a92097..dfc6197792 100644
--- a/doc/admin-guide/plugins/s3_auth.en.rst
+++ b/doc/admin-guide/plugins/s3_auth.en.rst
@@ -148,3 +148,11 @@ This is a pretty bare bone start for the S3 services, it 
is missing a number of
 
 
 Contributions to any of these would be appreciated.
+
+
+Retrying config loading
+=======================
+
+If the specified configuration file cannot be opened or is missing required 
options, ATS will attempt to reload the file repeatedly with exponential 
backoff.
+
+If the configuration file includes an `expiration` parameter and the file has 
exceeded its expiration time, ATS will retry loading the file every minute for 
a duration of 10 minutes. After 10 minutes, the file must be manually reloaded.
diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index 4f7ed0fbc4..d177b9ff47 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -394,6 +394,12 @@ public:
     return _conf_reload_count++;
   }
 
+  int
+  incr_invalid_file_count()
+  {
+    return _invalid_file_count++;
+  }
+
   // Setters
   void
   set_secret(const char *s)
@@ -474,6 +480,12 @@ public:
     _conf_reload_count = 0;
   }
 
+  void
+  reset_invalid_file_count()
+  {
+    _invalid_file_count = 0;
+  }
+
   // Parse configs from an external file
   bool parse_config(const std::string &filename);
 
@@ -531,6 +543,7 @@ private:
   long      _expiration          = 0;
   char     *_conf_fname          = nullptr;
   int       _conf_reload_count   = 0;
+  int       _invalid_file_count  = 0;
 };
 
 bool
@@ -1046,9 +1059,12 @@ config_reloader(TSCont cont, TSEvent /* event ATS_UNUSED 
*/, void *edata)
   S3Config *file_config = gConfCache.get(s3->conf_fname());
 
   if (!file_config || !file_config->valid()) {
-    TSError("[%s] requires both shared and AWS secret configuration", 
PLUGIN_NAME);
+    TSError("[%s] invalid configuration. Check mandatory fields. Scheduling 
reload", PLUGIN_NAME);
+    long delay = 1 << s3->incr_invalid_file_count();
+    s3->schedule_conf_reload(delay);
     return TS_ERROR;
   }
+  s3->reset_invalid_file_count();
 
   {
     std::unique_lock lock(s3->reload_mutex);

Reply via email to