Review main Merged

85324[FEATURE] Allow key prefix for Redis keys

Markus Klein CR +2 V +2 Normal +189 −8 updated 09/10/24, 17:57

Commit message

Adds the possibility to configure Redis key prefixes
for cache and session backends, which allows to use
the same Redis database for multiple caches and/or
TYPO3 instances.

Review

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

Issues 1

Files 4

Review log 4156

Show 2231 earlier messages
  1. Markus Klein uploaded patch set 1 07/22/24, 11:26

  2. core-ci voted on patch set 1 V -1 07/22/24, 11:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61925

  3. Georg Ringer uploaded patch set 2 V -1 07/26/24, 06:53

  4. core-ci voted on patch set 2 V +1 07/26/24, 07:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62253

  5. Markus Klein uploaded patch set 3 V +1 09/02/24, 13:15

  6. core-ci voted on patch set 3 V -1 09/02/24, 13:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64631

  7. Markus Klein marked it ready for review 09/02/24, 13:37

  8. Markus Klein uploaded patch set 4 V -1 09/02/24, 13:38

  9. core-ci voted on patch set 4 V +1 09/02/24, 13:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64632

  10. Simon Praetorius commented on patch set 4 09/02/24, 14:31

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:14

    Small detail: It is NOW possible :)
  11. Nikita Hovratov commented on patch set 4 09/02/24, 16:54

    RedisBackend.php:3

    This could actually be breaking.

    RedisBackend.php:48

    Can we keep unrelated cleanup to a minimum? Would be nice to prepare a pre-patch for this, so that the actual patch is clearer.

    RedisBackend.php:471

    I think a simple foreach is cleaner here.

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:60

    I believe "Impact" describes the benefits of this feature in a few short sentences, not if it has impact on existing instances (which shouldn't be for new features anyway). For this case, it would be almost identical to the description I guess.
  12. Markus Klein commented on patch set 4 09/03/24, 06:46

    RedisBackend.php:3 Reply

    Where? This class calls almost no other code and data types within this class should be fine. At least I didn't have issues while testing.

    RedisBackend.php:48 Reply

    The "cleanup" evolved while I wrote the patch. I actually did not consider the pre-cleanup in this case, because these classes are usually of low interest to the reviewers and hence waiting to get two patches merged seems more unrealistic than hoping for a single one. (I actually doubt that this one will make it, but, finger crossed. :-))

    RedisBackend.php:471 Reply

    fine with me, can adapt.

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:14 Reply

    Thanks, will take care

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:60 Reply

    That's why the Impact-section does not make any sense if I repeat the general feature description. A feature may have some impact on existing installations, we had that in the past quite a lot, and therefore I used this section to make clear that there is no impact for existing installations.
  13. Markus Klein commented on patch set 5 V +1 09/03/24, 08:43

    Published edit on patch set 4.
  14. Markus Klein commented on patch set 5 09/03/24, 08:43

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:14 Reply

    Done
  15. Markus Klein uploaded patch set 6 09/03/24, 08:45

  16. Markus Klein commented on patch set 6 09/03/24, 08:46

    RedisBackend.php:471 Reply

    Done
  17. core-ci voted on patch set 5 V +1 09/03/24, 08:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64653

  18. core-ci voted on patch set 6 V +1 09/03/24, 09:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64654

  19. Nikita Hovratov commented on patch set 6 09/03/24, 11:32

    RedisBackend.php:3 Reply

    Okay I see, there are no type hints for methods anyway. But this also means that this does almost nothing. Only for the new methods added.

    RedisBackend.php:48 Reply

    Pure cleanup patches get in quick. I will vote for it and maybe someone like lolli or Stefan will merge. This will increase the chances the actual patch gets merged, as it is easier to review.

    Feature-104451-RedisBackendsSupportForKeyPrefixing.rst:60 Reply

    Okay, then let's keep it this way.
  20. Markus Klein commented on patch set 6 09/03/24, 11:45

    RedisBackend.php:48 Reply

    Let's see, what I can do.
  21. Markus Klein uploaded patch set 7 V +1 09/03/24, 11:52

  22. Markus Klein commented on patch set 7 09/03/24, 11:52

  23. core-ci voted on patch set 7 V -1 09/03/24, 12:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64664

  24. Markus Klein rebased onto patch set 8 V -1 09/04/24, 18:47

  25. core-ci voted on patch set 8 V +1 09/04/24, 18:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64806

  26. Stefan Bürk uploaded patch set 9 V +1 09/04/24, 19:27

  27. core-ci voted on patch set 9 V +1 09/04/24, 19:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64809

  28. Stefan Bürk commented on patch set 9 09/04/24, 19:41

    Fixed rendering issues in the ReST file.

    RedisBackend.php:475

    Using `multi()` is not atomic and each `del()` is send as dedicated action and not as block to the server anyway as far as I could research so far. A pipeline sends them in one block but may eventually have other side effects. Method `removeIdentifierEntriesAndRelations()` uses a pipeline instead and provide multip keys within a single `$queue->del()` call - does that not make more sense ?
  29. Markus Klein commented on patch set 9 CR -1 09/04/24, 20:17

    Reply

    Thx

    RedisBackend.php:475 Reply

    I somehow missed that it supports arrays. Will adjust this.
  30. Markus Klein uploaded patch set 10 CR -1 V +1 09/04/24, 20:24

  31. Markus Klein commented on patch set 10 09/04/24, 20:27

    RedisBackend.php:475 Reply

    Now went with a real multi-mode, which should be atomic.
  1. core-ci voted on patch set 10 V +1 09/04/24, 20:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64812

  2. Benni Mack voted on patch set 10 CR +1 09/04/24, 20:34

  3. Stefan Bürk commented on patch set 10 09/04/24, 21:09

    Should we cover this with a functional test (prefixed key deletion) ?
  4. Markus Klein commented on patch set 10 09/05/24, 06:57

    Reply

    Do we have a running Redis during functionals? Then: Yes of course!
  5. Stefan Bürk commented on patch set 10 09/05/24, 14:10

    Reply

    Build/Scripts/runTests.sh -s functional starts a redis server and thus executing functional tests with a redis test. (And thus CI).
  6. Stefan Bürk commented on patch set 10 09/05/24, 14:11

    Reply

    typo3/sysext/core/Tests/Functional/Cache/Backend/RedisBackendTest.php
  7. Markus Klein commented on patch set 10 09/09/24, 08:15

    Reply

    Done
  8. Markus Klein uploaded patch set 11 CR +1 V +1 09/09/24, 08:16

  9. core-ci voted on patch set 11 V +1 09/09/24, 08:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65064

  10. Tymoteusz Motylewski commented on patch set 11 09/09/24, 09:04

    RedisBackendTest.php:229

    it would be nice to have also the assertion that with other prefix you dont see the other data.
  11. Christian Kuhn commented on patch set 11 09/09/24, 14:05

    RedisBackend.php:300

    why the public getter? setting a prefix should be a sink for this implementation. imho either drop the getter, or at least protect it?
  12. Markus Klein uploaded patch set 12 V +1 09/09/24, 14:43

  13. Markus Klein commented on patch set 12 09/09/24, 14:48

    RedisBackend.php:300 Reply

    Thx. Mishap, wasn't on purpose. Done. Removed.

    RedisBackendTest.php:229 Reply

    Not sure how to test for this, since the key always includes the prefix now, it is impossible to receive anything else.
  14. Markus Klein uploaded patch set 13 09/09/24, 14:48

  15. core-ci voted on patch set 12 V +1 09/09/24, 14:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65102

  16. Stefan Bürk commented on patch set 13 09/09/24, 14:53

    RedisBackendTest.php:229 Reply

    Instead of using the setter, it would be better to pass it as backend option to ``` $this->setUpSubject(['keyPrefix' => '...']); ``` That way, you can also create two redis backends ... setting on two backends the same key and check if it gets overriden. With same setup, it could also be checked if flush is called on one backend that the key(s) in the second (same db/another keyprefix) will not loose the key(s) and data.
  17. core-ci voted on patch set 13 V +1 09/09/24, 14:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65103

  18. Stefan Bürk uploaded patch set 14 V +1 09/10/24, 11:52

  19. Stefan Bürk commented on patch set 14 09/10/24, 11:53

    RedisBackendTest.php:229 Reply

    Done and also added additional tests.
  20. core-ci voted on patch set 14 V +1 09/10/24, 12:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65224

  21. Stefan Bürk uploaded patch set 15 V +1 09/10/24, 12:01

  22. core-ci voted on patch set 15 V +1 09/10/24, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65226

  23. Stefan Bürk voted on patch set 15 CR +1 V +1 09/10/24, 12:20

  24. Benni Mack voted on patch set 15 CR +2 V +2 09/10/24, 17:57

  25. Benni Mack merged patch set 16 09/10/24, 17:57