Repository navigation
Conversation
08ede5a to
cc239f8
Compare
cc239f8 to
ce8a0e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 42 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
doc/developer-guide/cache-architecture/architecture.en.rst:481
- This statement is too absolute: cache pinning is driven by the cache rule configuration selected by proxy.config.cache.control.filename. During migration, pinning can still be configured via legacy cache.config when explicitly selected, so the docs should not imply cache.yaml is the only option.
Objects can only be pinned via :file:`cache.yaml` and while
:ts:cv:`proxy.config.cache.permit.pinning` is set to non-zero (it is zero by
doc/developer-guide/cache-architecture/architecture.en.rst:105
- The sentence mixes plural subject with singular verb ("are derived" ... "is recomputed") and it reads as if only cache.yaml can drive cache layout. ATS can still be configured to use legacy cache.config via proxy.config.cache.control.filename, so this paragraph should refer to the cache rule configuration generally and fix the grammar.
This issue also appears on line 480 of the same file.
The layout and structure of the cache spans, the cache volumes, and the cache
stripes that compose them are derived entirely from :file:`storage.yaml` and
:file:`cache.yaml` and is recomputed from scratch when the
:program:`traffic_server` is started. Therefore, any change to those files can
(and almost always will) invalidate the existing cache in its entirety.
doc/developer-guide/cache-architecture/data-structures.en.rst:101
- CacheControlResult is used for both cache.yaml rules and legacy cache.config entries (depending on proxy.config.cache.control.filename). The description should avoid implying it only applies to cache.yaml.
Holds the actions and match state from a rule in :file:`cache.yaml`.
cmcfarlen
left a comment
There was a problem hiding this comment.
The core of this is well built — the first-match implementation in particular is subtler than it looks and it's correct. My concerns are all on the migration side: the default filename moves, and I don't think an existing deployment finds out what happened.
The design is sound
Worth saying explicitly since it's the part most likely to draw scrutiny: parsing YAML, re-serializing to legacy matcher text in build_matcher_config(), and feeding that to BuildTableFromString() is a pragmatic way to reuse ControlMatcher without forking it.
And the first-match semantics are implemented in the one way that actually works. CheckForMatch(h_rdata, result->matched_rule_line) resolves to (last_number < 0 || last_number > this->line_num) && CheckModifiers(...), so the lowest line number wins, and since build_matcher_config() emits rules in document order, ordering is preserved across the host / ip / regex / host_regex / url sub-tables rather than depending on which table ControlMatcher happens to consult first. That's the trap here and you avoided it.
I also checked two things that looked risky and aren't:
quote_matcher_value()escapes\and", andparseConfigLine()'sPARSE_VALstate unescapes exactly those inside quotes (MatcherUtils.cc:495-527). So regexes with backslashes survive the text round-trip.- A maximally-specified rule emits ~18 tokens against
MATCHER_MAX_TOKENS = 40. Plenty of headroom.
1. An existing deployment silently loses every cache rule
Filenames.h flips the default:
- constexpr const char *CACHE = "cache.config";
+ constexpr const char *CACHE = "cache.yaml";Consider the common upgrade: cache.config on disk, no explicit proxy.config.cache.control.filename in records.yaml. After upgrade, load_cache_control_table() resolves cache.yaml, hits result.file_not_found, logs
Cannot open cache configuration /etc/trafficserver/cache.yaml
at DL_Warning, and returns the empty DONT_BUILD_TABLE table. Every rule the operator had stops applying, and the only signal is one warning naming a file they never created and don't expect to exist.
The failure is asymmetric in the bad direction: a never-cache rule quietly becoming "cache normally" is a correctness and potentially privacy problem, not a performance regression. Same for pin-in-cache and ttl-in-cache disappearing.
The fix is small and self-contained — when the configured path ends in .yaml/.yml and is absent, check for a sibling cache.config, and if it's there make the message say so:
Cannot open cache configuration /etc/trafficserver/cache.yaml, but
/etc/trafficserver/cache.config exists. cache.yaml is now the default;
convert with 'traffic_ctl config convert cache cache.config cache.yaml'
(note: cache.yaml uses first-match semantics), or set
proxy.config.cache.control.filename to cache.config.
That turns a silent misconfiguration into an actionable one, which for a default-flipping change feels like the minimum bar.
2. Nothing in the upgrading guide
The .. deprecated:: 11.0 block you added to the cache.config page is genuinely good — it names the converter and tells operators to review overlapping rules. But it's on the reference page for the legacy file, which is not where someone planning an upgrade looks.
whats-new.en.rst gets five lines, and that's a feature announcement, not an upgrade instruction. doc/release-notes/upgrading.en.rst isn't touched at all.
Having just written the 10.2.0 release notes and upgrading guide, this is squarely the class of change that upgrading exists for: the default config filename changed, an existing file is no longer read unless a record is set, and converting changes rule-matching behavior. All three belong there, ideally with the records setting spelled out as the no-op escape hatch for operators who want to defer.
3. The converter doesn't mention that it can't preserve behavior
convert_cache() parses, marshals, writes, and prints Converted <in> -> <out>. Searching src/config/ and src/traffic_ctl/ for first.match, additive, or semantic finds nothing.
The conversion is faithful syntactically and cannot be faithful semantically — a legacy file with two overlapping rules composed both actions, and the converted file will apply only the first. That asymmetry is the one thing the tool is uniquely positioned to say, at the moment the operator is paying attention.
Minimum viable version: if the input parsed to two or more rules, print a note pointing at the docs. Better: flag pairs that could both match — same primary key type, or one rule's match set being a subset of another's — and name the line numbers so the operator knows where to look. Even a crude over-approximation is more useful than silence, because the operator can rule out false positives and can't discover false negatives.
4. The legacy runtime path has no end-to-end coverage left
negative-caching.test.py and cache_config_reload.test.py were both converted to cache.yaml. After this PR the only cache.config references under tests/gold_tests/ are trafficserver.test.ext (the harness's file definition) and convert_cache/, which never starts ATS against one.
So the additive legacy parser — what every deployment runs today, and which this PR deliberately keeps supported — has nothing verifying that ATS still honors it. The unit tests are good on parsing and marshalling (six cases including full legacy field coverage and a round-trip), but none of them pin the runtime semantics, and that's where the two formats now deliberately differ.
A change that accidentally routed cache.config through the first-match path would pass CI today. Since divergent semantics is the headline of the PR, it deserves a test that fails when it stops being true — ideally a paired one: identical rule sets in both formats, asserting composed actions for .config and first-match-only for .yaml. Keeping one of the two converted tests on cache.config would also do.
Smaller items
- Newlines aren't escaped.
quote_matcher_value()handles\and", butmatcher_configis line-oriented and a YAML value containing a newline (trivial with a quoted scalar) would split a rule across lines and misparse. Cheapest fix is rejecting embedded newlines inCacheConfigParserwith a clear error. convert_cache()doesn't check the output stream.out << yaml_output << '\n'; out.close();then reports success. A full disk or quota yields a truncatedcache.yamlplusConverted .... Worth testingoutafter close before printing.- Both the file and stdout paths append
'\n'afterto_yaml(). Ifto_yaml()already newline-terminates, every converted file gains a trailing blank line. whats-new.en.rstandcache.config.en.rsteach lose their trailing blank line — incidental churn.- The branch is 270 commits behind master and will need a rebase;
whats-new.en.rstis a frequent conflict point, so sooner is easier.
ce8a0e7 to
626eab0
Compare
|
Addressed the review feedback and force-pushed the rebased commit
Validation in the
|
626eab0 to
25c6840
Compare
6e3ab0e to
0196d33
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The current YAML pipeline drops internal: false semantics due to incorrect std::optional<bool> presence checks, which can change rule matching behavior and conversion output.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 46/46 changed files
- Comments generated: 2
- Review effort level: Lite
0196d33 to
173069a
Compare
173069a to
f908b64
Compare
cmcfarlen
left a comment
There was a problem hiding this comment.
Thanks for working through all of this — the sibling cache.config warning, the converter's first-match warning, and the paired additive/first-match Uranium tests are exactly what I was hoping for, and the stream and newline fixes look right.
A few things before this goes in:
- The legacy exact-URL
url=selector has no migration path. The runtime accepts it (http_dest_tagsincludesurl), butCacheConfigParser's legacy reader reports it as an unknown key, andcache.yamlhas no field for it. Sotraffic_ctl config convert cachefails on any file using it, and there's nothing to write by hand either.tests/uranium_tests/cache/replay/cache-exact-url.test.yaml(url=http://...{SERVER_HTTP_PORT}/exact action=never-cache) only passes becausereplay.pykeeps it oncache.config. This was Copilot's 10/02 comment oncache.cc, which never got a reply. Adding an exacturlmatch key, and converting that test tocache_yaml, would close it. - The upgrading note is under "Upgrading to ATS v10.x › Changes to Features", right after the 10.0 JSON-RPC entry. It belongs in the v11.x section, probably "Configuration Changes".
- The branch conflicts with master, and this push predates the URTest job, so
cache-config-additiveandcache-yaml-first-matchhaven't run in CI yet. They're the tests that pin the semantic split, so a rebase plus[approve ci urtest]would be good.
On Copilot's 10/02 comment that first-match breaks across matcher types: I don't think it's right. CheckForMatch(h_rdata, result->matched_rule_line) only accepts a rule whose line comes before the current best match, and an accepted rule replaces the whole result. So a later dest_domain match from the host table is overwritten when the earlier url_regex rule matches in the regex pass, whatever order ControlMatcher::Match() visits the tables in.
Nit: cache.config.en.rst and whats-new.en.rst still drop their trailing blank line.
f908b64 to
22965ba
Compare
|
Thanks for the review. I rebased onto current
I agree with your reading of Copilot's first-match comment and replied on that thread. Local validation in a Fedora container: build, install, and docs build passed. 92 |
|
[approve ci urtest 3] |
|
[approve ci urtest] |
cmcfarlen
left a comment
There was a problem hiding this comment.
Thanks, both rounds are resolved, including exact url=, and you're right about CacheControl.cc:574; I'll resolve that thread. One remaining gap in R1.1: install_configs.cmake installs cache.yaml.default as cache.yaml when none exists (packages will do the same, since it's a new file), so an upgrade over an install with only a cache.config ends up with a valid cache: []. The file_not_found branch never runs, and the legacy never-cache rules are dropped silently. The uranium harness already works around exactly this. Could the sibling-cache.config warning also fire when the YAML yields 0 rules and a non-empty cache.config sits next to it?
Minor: dest_ip rules with overlapping ranges don't follow first-match, because IpMatcher keeps only the most recently added rule for an address. That's the same as legacy cache.config, so a doc caveat is enough. Also, the primary-key list in cache.yaml.default leaves out url.
|
[approve ci doxygen] |
22965ba to
ac18c44
Compare
|
[approve ci format] |
|
The last push looks like a rebase only. The 11-09 items are still open: the zero-rule |
ac18c44 to
4a7fedf
Compare
cache.config needs to move to cache.yaml, with a supported migration path for existing deployments. cache.yaml becomes the default format, while cache.config remains available when explicitly selected. This adds a shared cache parser and marshaller used by traffic_server and traffic_ctl. The new `traffic_ctl config convert cache` command converts legacy files to cache.yaml or writes the result to stdout. This also addresses apache#7701 by giving cache.yaml ordered, first-match semantics, so broader rules no longer compound actions after a specific match. The legacy cache.config parser retains its additive behavior. Fixes: apache#7701 Co-authored-by: Codex GPT-6.1 Sol High Co-authored-by: GPT-6 Astra Medium Co-Authored-By: Claude Opus 5.5 <[email protected]>
Doxygen rejects a second @section license label, so the Doxygen check failed once cache.h and cache.cc both declared one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4a7fedf to
efa880f
Compare
|
@cmcfarlen Thanks, and sorry the last push was only a rebase. All three 11-09 items are addressed in 28ccf55, the main commit. Head is now efa880f, rebased onto current
The rebase also picks up the Ruff and cmakefmt format changes. The only reformatted files in this PR were Local validation in a Fedora CI container: format, build, and install passed. 216 cache, |



cache.config needs to move to cache.yaml, with a supported migration
path for existing deployments. cache.yaml becomes the default format,
while cache.config remains available when explicitly selected.
This adds a shared cache parser and marshaller used by traffic_server
and traffic_ctl. The new
traffic_ctl config convert cachecommandconverts legacy files to cache.yaml or writes the result to stdout.
This also addresses #7701 by giving cache.yaml ordered, first-match
semantics, so broader rules no longer compound actions after a specific
match. The legacy cache.config parser retains its additive behavior.
Fixes: #7701