-
Notifications
You must be signed in to change notification settings - Fork 847
Change remap loading to be fatal during startup. #8802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for working on this @SolidWallOfCode. I think we'll want to mark this for the 9.2.x project as well since the patch that introduced the issue went into 9.2.x. |
|
|
||
| std::error_code ec; | ||
| std::string content{ts::file::load(ts::file::path{path}, ec)}; | ||
| if (ec.value() == ENOENT) { // a missing file is ok - treat as empty, no rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I haven't had enough coffee today, but how is a missing file ok? I know we'd want that to be a failure for our systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general policy for ATS we want to not require the existence of configuration files. If an empty file is acceptable, it shouldn't be required to actually put one there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a specific setting to not force having a remap.config -- proxy.config.url_remap.remap_required https://docs.trafficserver.apache.org/admin-guide/files/records.config.en.html#proxy-config-url-remap-remap-required, which has existed since the first commit. I'd expect a missing file to need that setting set to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that setting means a remap rule is not required to forward the transaction. It has nothing to do with whether there is an actual "remap.config" file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a specific setting to not force having a remap.config -- proxy.config.url_remap.remap_required https://docs.trafficserver.apache.org/admin-guide/files/records.config.en.html#proxy-config-url-remap-remap-required, which has existed since the first commit. I'd expect a missing file to need that setting set to 0.
This also seems correct to me. Do we at least want a warning in diags.log if remap.config is empty? Do we know of ATS users who don't do any remapping?
randall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want some clarification before this is merged.
|
Does this still allow a remap to be partially loaded when it's bad? IMHO that's still a very bad issue since it allows problems to crop up that are even worse than just not reloading the file, you could end up with all_services-1 not being able to serve |
|
No. The partial loading still happens during startup, but ATS is then immediately shut down so it's irrelevant. Reloads continue to be atomic (all or nothing of the new configuration). |
|
Reading comments, I think we
As such, my strong preference is that we back out this train of PRs from 9.2.x, and roll forward with 10.0.x |
Revert "Short circuit remap reload when a valid remap file is not specified (apache#7782)" This reverts commit d7847f2. This is being reverted from 9.2.x because changing remap.config loading behavior was deemed too big a change to make within the 9.x releases. See the discussion in apache#8802. These remap.config changes will be pursued in the 10.x train.
|
I think @SolidWallOfCode has a strong preference to not revert. |
|
I went back and checked. Prior to #7782 a missing "remap.config" was allowed. This is a reversion to previous behavior. I have checked this in four cases to verify the operation is what is requested.
This makes "remap.config" loading atomic - all of the file, or none of it. |
|
This change unifies start up and reload handling of "remap.config". It also changes startup failure to However, due to some pushback, I plan to add a configuration variable to enable requiring a minimum number of rules in the "remap.config" to be valid. The default, at least for 9.2, will be 1. This means an empty or missing file won't replace a valid file. That can be changed by adjusting the configuration value. LinkedIn and Apple. I pondered a configuration for requiring a file but decided that was too indirect - a file with just comments is really an empty file. Valid rules are the correct metric for determining the "emptiness" of a file. |
|
@bneradt is going to review this |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a few minor suggestions.
| Set this variable to ``1`` if you want to retain the client host | ||
| header in a request during remapping. | ||
|
|
||
| .. ts:cv:: CONFIG proxy.config.url_remap.min_rules_required INT 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we want to use 0 here since that's the default.
zwoop
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Alan, appreciate you humoring the senile old geyser.
randall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! This is great!
Revert "Short circuit remap reload when a valid remap file is not specified (#7782)" This reverts commit d7847f2. This is being reverted from 9.2.x because changing remap.config loading behavior was deemed too big a change to make within the 9.x releases. See the discussion in #8802. These remap.config changes will be pursued in the 10.x train. Co-authored-by: bneradt <bneradt@yahooinc.com>
This also enables a missing "remap.config" to be treated as an empty file (that is, it "parses" successfully and yields no remap rules).
Due to feedback, this now adds a configuration variable, "proxy.config.url_remap.min_rules_required" to control how many rules are need in "remap.config" to be considered a valid configuration. With this a deployment can easily tune whether empty/missing file is acceptable. The PR has been updated with documentation and tests for this. Note the value is dynamic and it is therefore possible to have different behavior on startup vs. runtime (e.g. allow empty on start but not on reload).
Closes #8785