Review main Merged

87555[BUGFIX] Respect per-site settings in TypoScript cache identifiers

Benjamin Franzke CR +2 V +2 Normal +101 −2 updated 12/23/24, 11:59

Commit message

With #104544 site sets have already been included in the TypoScript
cache identifiers, but it turns out we need to include the site
identifier in order to account for possibly unique per-site settings.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 3

Files 7

Review log 2227

Show 12 earlier messages
  1. Benjamin Franzke uploaded patch set 1 12/18/24, 09:26

  2. core-ci voted on patch set 1 V +1 12/18/24, 09:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71364

  1. Benjamin Franzke uploaded patch set 2 V +1 12/18/24, 11:43

  2. core-ci voted on patch set 2 V +1 12/18/24, 11:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71371

  3. Kevin Appelt updated the commit message in patch set 3 V +1 12/18/24, 13:30

  4. core-ci voted on patch set 3 V +1 12/18/24, 13:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71383

  5. Benjamin Franzke updated the commit message in patch set 4 V +1 12/18/24, 13:39

  6. core-ci voted on patch set 4 V +1 12/18/24, 13:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71384

  7. Stefan Bürk commented on patch set 4 12/19/24, 10:07

    FrontendTypoScriptFactory.php:130

    Should we make this `siteIdentifier` AND `sets` dependant ? If sets changes (through the chain) but the same site identifier it would be the same cache - or do I miss something here ? (same for other places).
  8. Christian Kuhn commented on patch set 4 12/19/24, 11:10

    could we add a regression test similar to what we did with https://review.typo3.org/c/Packages/TYPO3.CMS/+/87557 ?
  9. Christian Kuhn commented on patch set 4 12/19/24, 11:11

    Reply

    ... unsure why gerrit tends to set comments resolved sometimes, even though i unchecked the box ...
  10. Benjamin Franzke commented on patch set 4 CR -1 12/19/24, 11:27

    Reply

    yes, thx. will add them

    FrontendTypoScriptFactory.php:130 Reply

    Not sure, this cache identifier is not (yet) about automatic cache invalidation (or maybe it was intended to be?), since then we'd also need to hash the set contents, and sys template static file inclusion contents and so on – this cache needs to be flushed explicitly. That means: This cache identifier is currently only here to "isolate" matching caches. Don't get me wrong, I'd love automatic cache invalidation here as well, but I think we're not there yet, and therefore thought I rather remove the now unneeded sets in the hash, as site-identifier is unique per site.
  11. Benjamin Franzke commented on patch set 4 12/19/24, 11:29

    FrontendTypoScriptFactory.php:130 Reply

    forgot to mention: We actually did the same in other patches: > 79515: [BUGFIX] Correct multi site FE TypoScript caches | https://review.typo3.org/c/Packages/TYPO3.CMS/+/79515 That means we'd need to adapt a lot of places if we want full auto-change-invalidation coverage.
  12. Benjamin Franzke uploaded patch set 5 CR -1 V +1 12/19/24, 11:39

  13. Benjamin Franzke commented on patch set 5 12/19/24, 11:39

    Reply

    Done, added the same case to the test but with site-sets instead of sys_template (which fail without this bugfix because `BrandFoo` of site-1 was also cached in this upper layer for site-sets)
  14. Benjamin Franzke commented on patch set 5 12/19/24, 11:41

    Reply

    > which fail I meant to refer to the new test, not sys_template. Grammar was wrong…
  15. core-ci voted on patch set 5 V +1 12/19/24, 11:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71448

  16. Christian Kuhn commented on patch set 5 12/19/24, 11:53

    FrontendTypoScriptFactory.php:130 Reply

    yeah. when site settings are changed, cache flushes should be triggered since site detail information can potentially materialize in many different caches, and we don't know all candidates up front. as such, i think it is ok to only use the site-identifier here as cache identifiers here. isn't there also some patch that adds/improves cache flushing when site configs are changed using the UI? not sure, thought i saw something a while ago. and when deploying .yaml files directly, we can assume deployment scripts flush caches anyways.
  17. Benjamin Franzke commented on patch set 5 12/19/24, 11:57

    FrontendTypoScriptFactory.php:130 Reply

    yes, that was this one: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84185/4#message-5a565ab8de59c2a4a9bdec7d731be80f62db9f7c There is a discussion that we'd need to pick up again. It was about multiple cache tags in favor of less-extensive flushing or not.
  18. Benjamin Franzke commented on patch set 5 12/19/24, 12:01

    FrontendTypoScriptFactory.php:130 Reply

    And I agree about the deployment part you mentioned, we rely on explicit flushes for code changes anyway. There is only one "small" obstacle for deployments: Typoscript is cached in the group "pages" instead of "system", therefore `typo3 cache:flush warmup -g system` is not able to warmup typoscript caches until also page caches are flushed. But I haven't thought about negative consequences of moving typoscript caches from group pages to system… Anyway, this is getting super offtopic. TL;DR yes, deployments need explicit flushes
  19. Benjamin Franzke commented on patch set 5 12/19/24, 12:01

    FrontendTypoScriptFactory.php:130 Reply

    I meant `bin/typo3 cache:warmup -g system`
  20. Christian Kuhn commented on patch set 5 12/19/24, 12:24

    FrontendTypoScriptFactory.php:130 Reply

    yeah. TS cache warmup is an open topic anyway: it is possible to at least tokenize all TS files and sys_template records we find within warmup. the tokenizer caches are the lowest cache levels and are stateless since tokenizing is a 1:1 input-snipped to tokenized representation operation without side effects. warmup should be do-able and is probably not that complex. a warmup of this could save various milliseconds on first call, depending on TS amount. i have this on my radar since the v12 ts parser rewrite, but didn't manage to get it done, and couldn't find anyone actively working on it, yet.
  21. Christian Kuhn commented on patch set 5 12/19/24, 13:37

    FrontendTypoScriptFactory.php:130 Reply

    we got a bit off topic here, but i think the initial question has been resolved in a satisfying way. i'll set 'resolved' here.
  22. Christian Kuhn voted on patch set 5 CR +1 V +1 12/19/24, 13:37

  23. Stefan Bürk commented on patch set 5 CR +1 V +1 12/23/24, 11:20

    FrontendTypoScriptFactory.php:130 Reply

    Thanks for the explanation.
  24. Stefan Bürk voted on patch set 5 CR +2 V +2 12/23/24, 11:59

  25. Stefan Bürk merged patch set 6 12/23/24, 11:59