Problem/Motivation
Sometimes we try to load entities that don't exist. This is most common with config entities - e.g. language content settings is a config entity per entity bundle, and not every bundle has language content settings, so we try to load something that may or may not exist.
However we don't statically cache the fact that an entity wasn't loaded, so we keep trying to load it from the persistent cache again and again.
Discovered because I was seeing multiple config cache gets for language content settings even after #3560633: Load content language settings in bulk when rebuilding bundle and extra fields info.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | 3587565-followup.patch | 2.59 KB | amateescu |
Issue fork drupal-3587565
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
catchMR is up.
Updated performance tests, other tests might fail still
Comment #4
catchComment #5
catchAdded a unit test. I don't know why AssetAggregationAcrossPagesTest needed an update - less files is good but not sure how this could affect that.
edit: it's because HEAD was broken.
Comment #6
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #7
catchRebased.
Comment #8
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #9
catchRebased.
Comment #10
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #11
catchComment #12
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #13
catchI'd briefly thought about separate methods but thought it would make cache invalidation etc. a bit more complex, however now we have uuid lookup caching in there, it's just another one.
So added a different cache key prefix for not found + get/set methods for not found entities and switched to using those. Agreed this looks better. If it did somehow break a subclass then I think it would at least be more obvious why.#
edit: it broke ConfigEntityStorage but found a way to unbreak it within the main base class for bc.
Comment #14
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #15
catchRebased.
Comment #16
catchRebased.
Comment #17
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #18
catchRebased.
Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
catchRebased.
Comment #21
berdirLooks good to me now.
Comment #22
godotislateSome questions about comments and a couple nits. OK to self-RTBC.
Comment #23
catchComment changes were all good spots, think I got everything.
Comment #24
godotislateNeeds a rebase after #3612172: Merge Umami performance tests.
Comment #25
catchRebased.
Comment #27
godotislateCommitted 36e3ad4 and pushed to main. Thanks!
Merge conflict in the performance tests. It might make sense to get #3612172: Merge Umami performance tests in to 11.x too.
Comment #29
catchPut up an 11.x MR, only performance test changes so moving straight back to RTBC.
Comment #30
godotislateTests are failing, including PHPStan.
Comment #31
catchMissed that... the unit test change applied cleanly, but it depends on a method that doesn't exist. We can just remove the call because the method sets up something that's in ::setUp().
Comment #33
godotislateCommitted 2ab239c and pushed to 11.x. Thanks!
Comment #35
amateescu commentedThis change broke some tests in Trash, where we have to prevent writing soft-deleted entities to the persistent cache. The fix is quite small, so I'm not sure whether a quick followup MR would be better than a new issue :)
Comment #36
catchRe-opening for visibility, I'd be fine either way with a follow-up MR vs. new issue, the same change should apply to both 11.x and main.
Comment #38
amateescu commentedCool, opened the followup MR here.
Comment #39
berdirI think I was wondering about whether that array_diff_key() was safe, but I thought more about the queried entities than $ids. This is consistent with an earlier calls to get missing ids.
Comment #42
catchCommitted/pushed to main and 11.x, thanks!