From 87435c029b51fb251f3b1903888a0242fedd4df4 Mon Sep 17 00:00:00 2001 From: Steve Hamrick Date: Thu, 15 Sep 2022 13:08:57 -0600 Subject: [PATCH] Allow update time params on Servers when CDN is locked. (#7065) * Allow lock updates on some server params * Add CHANGELOG and dont update when non-allowed fields are present. * Sort changelog * Fix issues * Code review and add to v5 tests --- cache-config/t3c-apply/torequest/cmd.go | 18 +++--------------- docs/source/overview/delivery_services.rst | 17 +++++++++-------- lib/go-atscfg/parentabstraction.go | 2 +- lib/go-atscfg/parentdotconfig.go | 2 +- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/cache-config/t3c-apply/torequest/cmd.go b/cache-config/t3c-apply/torequest/cmd.go index fc39356f0e..603e288996 100644 --- a/cache-config/t3c-apply/torequest/cmd.go +++ b/cache-config/t3c-apply/torequest/cmd.go @@ -294,21 +294,9 @@ func sendUpdate(cfg config.Cfg, configApplyTime, revalApplyTime *time.Time, conf return nil } -// doTail calls t3c-tail, which will read lines from the file at the provided -// path, and will print lines matching the 'logMatch' regular expression. -// When a line matching the 'endMatch' regular expression is encountered, -// t3c-tail will exit - which means it MUST NOT be an empty string or only the -// first line of the file will ever be read (and possibly printed, if it matches -// 'logMatch'). In any case, the process will terminate after 'timeoutInMS' -// milliseconds. -// Note that apart from an exit code difference on timeout, this is almost -// exactly equivalent to the bash command: -// -// timeout timeoutInS tail -fn+2 file | grep -m 1 -B "$(wc -l file | cut -d ' ' -f1)" -E endMatch | grep -E logMatch -// -// ... where 'timeoutInS' is 1/1000 of 'timeoutInMS' and the string values of -// arguments are otherwise substituted wherever they are found (GNU coreutils -// are assumed to be present). +// doTail calls t3c-tail and will run a tail on the log file provided with string for a regex to +// match on default is .* endMatch will make t3c-tail exit when a pattern is matched otherwise +// a timeout in a given number of seconds will occur. func doTail(cfg config.Cfg, file string, logMatch string, endMatch string, timeoutInMS int) error { args := []string{ "--file=" + filepath.Join(cfg.TsHome, file), diff --git a/docs/source/overview/delivery_services.rst b/docs/source/overview/delivery_services.rst index 79be7168f2..b6005318be 100644 --- a/docs/source/overview/delivery_services.rst +++ b/docs/source/overview/delivery_services.rst @@ -1028,6 +1028,7 @@ Each :term:`Parameter` directly corresponds to a field in a line of the :abbr:`A .. _max_simple_retries: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-max-simple-retries .. _max_unavailable_server_retries: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-max-unavailable-server-retries .. _parent_retry: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-parent-retry +.. _simple_server_retry_responses: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-simple-server-retry-responses .. _unavailable_server_retry_responses: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-unavailable-server-retry-responses .. _parent.config: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html .. _parent: https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/parent.config.en.html#parent-config-format-parent @@ -1043,20 +1044,20 @@ Each :term:`Parameter` directly corresponds to a field in a line of the :abbr:`A | algorithm | `round_robin`_ | Sets the algorithm used to determine from which :term:`origin server` content will | | | | be requested. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ - | max_simple_retries | `max_simple_retries`_ | Sets a strict limit on the number of "simple retries" allowed before giving up | + | max_simple_retries | `max_simple_retries`_ | The number of times to try a different :term:`origin server` after receiving a | + | | | simple_retry response code. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ - | max_unavailable_server_retries | `max_unavailable_server_retries`_ | Sets a strict limit on the number of times the :term:`cache server` will attempt to | - | | | request content from an :term:`origin server` that has previously been considered | - | | | "unavailable". | + | max_unavailable_server_retries | `max_unavailable_server_retries`_ | The number of times to try a different :term:`origin server` after receiving an | + | | | unavailable_server_retry response code. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ | parent_retry | `parent_retry`_ | Sets whether the :term:`cache servers` will use "simple retries", | | | | "unavailable server retries", or both. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ - | simple_retry_response_codes | **UNKNOWN** | **UNKNOWN** - supposedly defines HTTP response codes from an :term:`origin server` | - | | | that necessitate a "simple retry". | + | simple_server_retry_responses | `simple_server_retry_responses`_ | Defines HTTP response codes from an :term:`origin server` that will be considered | + | | | failures but the server will still be considered healthy for future requests. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ - | unavailable_server_retry_response_codes | `unavailable_server_retry_responses`_ | Defines HTTP response codes from an :term:`origin server` that indicate it is | - | | | currently "unavailable". | + | unavailable_server_retry_responses | `unavailable_server_retry_responses`_ | Defines HTTP response codes from an :term:`origin server` that will be considered | + | | | failures and the server will be marked as unhealthy. | +-----------------------------------------+------------------------------------------------------------+-------------------------------------------------------------------------------------+ The above :term:`Parameters` are supported for ``first``, ``inner`` and ``last`` tiers by specifying prefixes ``first.``, ``inner.`` and ``last.``, applicable to both topology and non topology. This allows fine tuning of marking parents "down" and retry behavior inside a CDN. diff --git a/lib/go-atscfg/parentabstraction.go b/lib/go-atscfg/parentabstraction.go index dab87aa27f..c5b1309c36 100644 --- a/lib/go-atscfg/parentabstraction.go +++ b/lib/go-atscfg/parentabstraction.go @@ -98,7 +98,7 @@ type ParentAbstractionService struct { // ErrorResponseCodes is the list of HTTP response codes from the parent // to consider as errors, but NOT mark the parent unhealthy. Typically 4xx codes. - // Becomes parent.config unavailable_server_retry_responses directive + // Becomes parent.config simple_server_retry_responses directive // Becomes strategies.yaml TODO ErrorResponseCodes []int diff --git a/lib/go-atscfg/parentdotconfig.go b/lib/go-atscfg/parentdotconfig.go index 2de9d97f8f..a381bddbb4 100644 --- a/lib/go-atscfg/parentdotconfig.go +++ b/lib/go-atscfg/parentdotconfig.go @@ -1125,7 +1125,7 @@ func getTopologyParentConfigLine( // getParentRetries builds the parent retry directive(s). // -// Returns the MaxSimpleRetries, MaxMarkdownRetries, ErrorREsponseCodes, MarkdownResponseCodes. +// Returns the MaxSimpleRetries, MaxMarkdownRetries, ErrorResponseCodes, MarkdownResponseCodes. // // If atsMajorVersion < 6, "" is returned (ATS 5 and below don't support retry directives). // If isLastCacheTier is false, "" is returned. This argument exists to simplify usage.