Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Child issue of #2497243: Replace Symfony container with a Drupal one, stored in cache.
The chained fast cache backend currently invalidates caches using the cache itself. This means if multiple webheads with local fast backends are used, invalidations are not consistent across all webheads - in case NTP is not used. (The timestamp solution works, but an atomic counter that cache tags provide is better).
Proposed resolution
Use the cache tag invalidation provider to track cache invalidations.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#25 | chainedfastbackend-invalidations-2508417-25.patch | 14.38 KB | jhedstrom |
Comments
Comment #1
jhedstromComment #3
Fabianx CreditAttribution: Fabianx as a volunteer commentedThe fast backend itself needs to take care of that, no need to do checksumming here.
This should never happen, unless allowInvalid is TRUE, but then the data is okay to be invalid regardless of hold old or outdated or inconsistent it is.
This should never be added to the consistentBackend().
This should all not be needed, the consistentBackend should already get its cache tags invalidated, the same for the fast backend.
Can remove the whole interface.
Comment #4
jhedstromThis is drastically simplified when moving away from the timestamp/write-based invalidation.
Removing the cache tags invalidator interface requires that cache tags *are* sent to the fast backend.
Comment #7
Fabianx CreditAttribution: Fabianx as a volunteer commentedThese two are actually still needed ...
Comment #9
jhedstromThis should address #7. Not sure why the CKEditor test is failing in the above patch though (it passes locally).
Comment #10
jhedstromComment #14
Fabianx CreditAttribution: Fabianx as a volunteer commentedNo, this chunk is wrong and was correct before ...
Comment #15
Fabianx CreditAttribution: Fabianx as a volunteer commented#14 is wrong ... nvm me :)
Comment #16
jhedstromI cannot reproduce the test fails in #9 locally on either php54 or php55.
Comment #19
jhedstromAh, interesting, these tests do fail on the command line. Digging into that now.
Comment #20
jhedstromSo from what I can tell, all of the failures that involve the "Undefined index: base" exception are due to Views relationship plugins being set to the 'broken' pluginId. In testing
Drupal\comment\Tests\Views\CommentRestExportTest
locally:viewsHandlerManager::getHandler()
is called withThe fact that views is looking for a field called
node
in thecomment_field_table
seems to indicate something going wrong elsewhere. What's really odd is that all the cache tests for this change are passing, so these failures might indicate some incomplete coverage there.The
Drupal\ckeditor\Tests\CKEditorLoadingTest
continues to pass through the UI, but fails from run-tests.sh, and doesn't appear related to the views data issue.Comment #21
jhedstromComment #22
jhedstromAfter a bit more digging, I am fairly certain the fails here are due to static cache issues. For instance, on the
CKEditorLoadingTest
, the mismatch that causes the test to fail is due to new plugins provided by the ckeditor_test module not properly being discovered. When these pass via the UI and fail via the test running script, it indicates a very subtle difference in execution where certain static caches are persisting only on the command line test runner.The obvious culprit was in
DatabaseCacheTagsChecksum::invalidateTags()
:but when I simply removed that logic for debugging purposes, the fail still persists.
Comment #23
jhedstromWasn't able to track this down completely. In addition to the snippet above, this bit in
DatabaseCacheTagsChecksum::calculateChecksum()
is also coming into play in terms of static caches causing invalidated items to look valid:The cid for the CKEditor issue is 'ckeditor_plugins' if anybody else picks this up while I'm offline.
Comment #24
jhedstromComment #25
jhedstromThis fixes some of the fails, but not the views handler ones.
Comment #26
Fabianx CreditAttribution: Fabianx as a volunteer commentedUhm, should invalidateTags not itself invalidate or rather invalidate and update the tag of itself?
That seems like a bug in the cache tag implementation.
Comment #28
Fabianx CreditAttribution: Fabianx as a volunteer commentedOkay, so there are consistent cache tag implementations and inconsistent cache tag implementations ...
A backend like APCu needs to use a consistent cache tag implementation, that always writes through and does not internally statically cache the tags ...
Comment #29
jhedstromComment #30
jhedstromComment #31
jhedstromI don't think using cache tags here is going to work. After discussing with Berdir, the decision to leave the fast cache backend independent of cache tags was explicit, and only sending in a custom bin invalidation tag has other issues with static caching as described above.
This might be won't fix unless there is a good reason to pull in the atomic counter concept.
Comment #32
Fabianx CreditAttribution: Fabianx as a volunteer commentedWell, to leave the fast cache backend independent of cache tags for all things, but using just the bin specific tag should be okay (and catch +1ed in general). So I think it is the implementation chosen here that is the problem, not the idea of using a consistent cache tags service in general.
I am also okay to use one atomic counter however - but it also means it needs to be re-implemented by memcache, redis, etc.