Re: [chrony-dev] [PATCH] local threshold option |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] local threshold option
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Thu, 28 Mar 2024 11:56:58 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711623420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ovgOksFeGKlgyvaazUXHxayPd3FdNoyDPZehMfPrnrg=; b=DLWumhswQTq57huxyRm7b5IlU830w3Wi8eeb3TE9ar0pU+o2utbN0UjY9UdxygSAB26ZzD /rRvX8Y9nthAd98JI6f1CwjXzT79/KymLhrfpW/VW5ibVlQ2j/GlByJQjo1T+CwOq2ki++ 4g3/gleuvNFW18K3JjAg+u5tLpxVo0k=
On Mon, Mar 25, 2024 at 07:10:31PM +0000, Andy Fiddaman wrote:
> How does the attached patch look? This adds `local threshold` as you
> suggested, that defaults to 0 which means it is not used. If it's set,
> then the local reference is not activated until the root distance drops
> below the value once.
>
> In our configuration, we can then use something like:
>
> local stratum 10 distance 1.0 threshold 1.0
The distance option is already described as a threshold, so I think a
different name might work better. How about trigger, start or activate?
Let's think a bit about possible future options. We might need a
timeout-based activation, e.g. wait for 10 minutes before activating
local. It could be a second parameter of this option or a separate
option. What naming would be most consistent?
> --- a/candm.h
> +++ b/candm.h
> @@ -237,6 +237,7 @@ typedef struct {
> int32_t stratum;
> Float distance;
> int32_t orphan;
> + Float threshold;
> int32_t EOR;
> } REQ_Local;
This is an incompatible change in the request, so there should be also
a new code defined (REQ_LOCAL3). You could also add a few reserved
fields to the command, so next time it could keep the code if the
original behavior is preserved by interpreting the old reserved
field.
> @@ -1699,6 +1699,11 @@ An example of the directive is:
> ----
> local stratum 10 orphan distance 0.1
> ----
> +*threshold* _distance_:::
> +This option sets an activating threshold for the local reference. The local
> +reference will not be used until the root distance drops below the configured
> +threshold once. This can be used to prevent the local reference being activated
> +on a server which has never been synchronised with an upstream server.
This should mention the special value of 0 and that it is the default.
> @@ -1158,7 +1163,11 @@ REF_GetReferenceParams
> *root_delay = our_root_delay;
> *root_dispersion = dispersion;
>
> - } else if (enable_local_stratum) {
> + if (distance > 0 && distance < local_threshold)
> + local_threshold_met = 1;
This should be earlier in the function so the new condition below can
trigger on the first pass?
> +
> + } else if (enable_local_stratum &&
> + (local_threshold == 0 || local_threshold_met)) {
Please use 0.0 in places where a floating-point variable is compared.
Thanks,
--
Miroslav Lichvar
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.