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 2018/01/12 16:48:12 UTC
[trafficserver] branch 7.1.x updated: Modify regex_revalidate so
that traffic_ctl may be used to trigger config file updates and add a
config parameter to disable timed updates if desired.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new f5b6194 Modify regex_revalidate so that traffic_ctl may be used to trigger config file updates and add a config parameter to disable timed updates if desired.
f5b6194 is described below
commit f5b61940f729e4eee5676c5c7422117a7498c59d
Author: jrushford <jr...@apache.org>
AuthorDate: Tue Dec 12 23:02:53 2017 +0000
Modify regex_revalidate so that traffic_ctl may be used to trigger
config file updates and add a config parameter to disable timed updates
if desired.
(cherry picked from commit 4da3d7c2408be0ff5424ad8ffd518b9cd2fca174)
---
doc/admin-guide/plugins/regex_revalidate.en.rst | 17 ++++++++++++-----
plugins/regex_revalidate/regex_revalidate.c | 25 +++++++++++++++++++++----
2 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/doc/admin-guide/plugins/regex_revalidate.en.rst b/doc/admin-guide/plugins/regex_revalidate.en.rst
index ab35e1b..80ee882 100644
--- a/doc/admin-guide/plugins/regex_revalidate.en.rst
+++ b/doc/admin-guide/plugins/regex_revalidate.en.rst
@@ -58,11 +58,18 @@ two required arguments: the path to a rules file, and the path to a log file::
The rule configuration file format is described below in `Revalidation Rules`_.
-The plugin regularly (every 60 seconds) checks its rules configuration file for
-changes. If the file has been modified since its last scan, the contents are
-read and the in-memory rules list is updated. Thus, new rules may be added and
-existing ones modified without requiring a service restart every time (as long
-as the delay of up to 60 seconds is acceptable).
+By default The plugin regularly (every 60 seconds) checks its rules configuration
+file for changes and it will also check for changes when ``traffic_ctl config reload``
+is run. If the file has been modified since its last scan, the contents
+are read and the in-memory rules list is updated. Thus, new rules may be added and
+existing ones modified without requiring a service restart.
+
+The configuration parameter `--disable-timed-updates` or `-d` may be used to configure
+the plugin to disable timed config file change checks. With timed checks disabled,
+config file changes are checked are only when ``traffic_ctl config reload`` is run.::
+
+ regex_revalidate.so -d -c <path to rules> -l <path to log>
+
Revalidation Rules
==================
diff --git a/plugins/regex_revalidate/regex_revalidate.c b/plugins/regex_revalidate/regex_revalidate.c
index 1c352b8..780ec31 100644
--- a/plugins/regex_revalidate/regex_revalidate.c
+++ b/plugins/regex_revalidate/regex_revalidate.c
@@ -349,6 +349,10 @@ config_handler(TSCont cont, TSEvent event ATS_UNUSED, void *edata ATS_UNUSED)
invalidate_t *i, *iptr;
TSCont free_cont;
bool updated;
+ TSMutex mutex;
+
+ mutex = TSContMutexGet(cont);
+ TSMutexLock(mutex);
TSDebug(LOG_PREFIX, "In config Handler");
pstate = (plugin_state_t *)TSContDataGet(cont);
@@ -373,6 +377,8 @@ config_handler(TSCont cont, TSEvent event ATS_UNUSED, void *edata ATS_UNUSED)
}
}
+ TSMutexUnlock(mutex);
+
TSContSchedule(cont, CONFIG_TMOUT, TS_THREAD_POOL_TASK);
return 0;
}
@@ -476,7 +482,8 @@ TSPluginInit(int argc, const char *argv[])
TSPluginRegistrationInfo info;
TSCont main_cont, config_cont;
plugin_state_t *pstate;
- invalidate_t *iptr = NULL;
+ invalidate_t *iptr = NULL;
+ bool disable_timed_reload = false;
TSDebug(LOG_PREFIX, "Starting plugin init.");
@@ -484,8 +491,10 @@ TSPluginInit(int argc, const char *argv[])
init_plugin_state_t(pstate);
int c;
- static const struct option longopts[] = {
- {"config", required_argument, NULL, 'c'}, {"log", required_argument, NULL, 'l'}, {NULL, 0, NULL, 0}};
+ static const struct option longopts[] = {{"config", required_argument, NULL, 'c'},
+ {"log", required_argument, NULL, 'l'},
+ {"disable-timed-reload", no_argument, NULL, 'd'},
+ {NULL, 0, NULL, 0}};
while ((c = getopt_long(argc, (char *const *)argv, "c:l:", longopts, NULL)) != -1) {
switch (c) {
@@ -499,6 +508,9 @@ TSPluginInit(int argc, const char *argv[])
TSTextLogObjectRollingOffsetHrSet(pstate->log, LOG_ROLL_OFFSET);
}
break;
+ case 'd':
+ disable_timed_reload = true;
+ break;
default:
break;
}
@@ -545,7 +557,12 @@ TSPluginInit(int argc, const char *argv[])
config_cont = TSContCreate(config_handler, TSMutexCreate());
TSContDataSet(config_cont, (void *)pstate);
- TSContSchedule(config_cont, CONFIG_TMOUT, TS_THREAD_POOL_TASK);
+
+ TSMgmtUpdateRegister(config_cont, LOG_PREFIX);
+
+ if (!disable_timed_reload) {
+ TSContSchedule(config_cont, CONFIG_TMOUT, TS_THREAD_POOL_TASK);
+ }
TSDebug(LOG_PREFIX, "Plugin Init Complete.");
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].