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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 75dafb0  do not reload configs periodically
75dafb0 is described below

commit 75dafb0d9ae6d6043f911cc57ffd37433494d306
Author: Fei Deng <[email protected]>
AuthorDate: Thu Oct 10 15:33:00 2019 -0500

    do not reload configs periodically
    
    (cherry picked from commit cd1485435bd5c5e52110149881d8bb07a8dad988)
---
 mgmt/ConfigManager.cc | 13 +++++++------
 mgmt/ConfigManager.h  |  7 ++++++-
 mgmt/FileManager.cc   |  4 ++--
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/mgmt/ConfigManager.cc b/mgmt/ConfigManager.cc
index e5ffa73..1eb94aa 100644
--- a/mgmt/ConfigManager.cc
+++ b/mgmt/ConfigManager.cc
@@ -95,12 +95,12 @@ ConfigManager::statFile(struct stat *buf)
   return statResult;
 }
 
-// bool ConfigManager::checkForUserUpdate()
+// bool ConfigManager::checkForUserUpdate(RollBackCheckType how)
 //
 //  Called to check if the file has been changed  by the user.
 //  Timestamps are compared to see if a change occurred
 bool
-ConfigManager::checkForUserUpdate()
+ConfigManager::checkForUserUpdate(RollBackCheckType how)
 {
   struct stat fileInfo;
   bool result;
@@ -113,10 +113,11 @@ ConfigManager::checkForUserUpdate()
   }
 
   if (fileLastModified < TS_ARCHIVE_STAT_MTIME(fileInfo)) {
-    fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
-    configFiles->fileChanged(fileName, configName);
-    mgmt_log("User has changed config file %s\n", fileName);
-
+    if (how == ROLLBACK_CHECK_AND_UPDATE) {
+      fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
+      configFiles->fileChanged(fileName, configName);
+      mgmt_log("User has changed config file %s\n", fileName);
+    }
     result = true;
   } else {
     result = false;
diff --git a/mgmt/ConfigManager.h b/mgmt/ConfigManager.h
index d27aed1..f32cb2a 100644
--- a/mgmt/ConfigManager.h
+++ b/mgmt/ConfigManager.h
@@ -31,6 +31,11 @@ class TextBuffer;
 
 class ExpandingArray;
 
+enum RollBackCheckType {
+  ROLLBACK_CHECK_AND_UPDATE,
+  ROLLBACK_CHECK_ONLY,
+};
+
 //
 //  class ConfigManager
 //
@@ -66,7 +71,7 @@ public:
   };
 
   // Check if a file has changed, automatically holds the lock. Used by 
FileManager.
-  bool checkForUserUpdate();
+  bool checkForUserUpdate(RollBackCheckType);
 
   // These are getters, for FileManager to get info about a particular 
configuration.
   const char *
diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc
index e5737e9..c23f17f 100644
--- a/mgmt/FileManager.cc
+++ b/mgmt/FileManager.cc
@@ -177,7 +177,7 @@ FileManager::rereadConfig()
     rb = it.second;
     // ToDo: rb->isVersions() was always true before, because numberBackups 
was always >= 1. So ROLLBACK_CHECK_ONLY could not
     // happen at all...
-    if (rb->checkForUserUpdate()) {
+    if (rb->checkForUserUpdate(ROLLBACK_CHECK_AND_UPDATE)) {
       changedFiles.push_back(rb);
       if (rb->isChildManaged()) {
         if (std::find(parentFileNeedChange.begin(), 
parentFileNeedChange.end(), rb->getParentConfig()) ==
@@ -237,7 +237,7 @@ FileManager::isConfigStale()
   ink_mutex_acquire(&accessLock);
   for (auto &&it : bindings) {
     rb = it.second;
-    if (rb->checkForUserUpdate()) {
+    if (rb->checkForUserUpdate(ROLLBACK_CHECK_ONLY)) {
       stale = true;
       break;
     }

Reply via email to