- Issue created by @larowlan
- π³πΏNew Zealand danielveza Brisbane, AU
Tested this on a large site with over 3000+ block content entities where I was running into OOM issues.
After saving a block and therefore having the Block definition caches cleared:
No patch: ~152MB memory usage
With patch: 76MB memory usage - Status changed to Needs work
10 months ago 11:27am 24 January 2024 - π¬π§United Kingdom catch
This looks great! One point on the MR to add a code comment. I still think we should do π block_content block derivatives do not scale to thousands of block_content entities Needs work but this will stop a lot of sites crashing in the meantime.
- Status changed to Needs review
10 months ago 9:26pm 24 January 2024 - Status changed to RTBC
10 months ago 9:56pm 24 January 2024 - π¬π§United Kingdom catch
Looks great. We've got the other issue(s) open to move away from derivatives, I think we could backport this to 10.2 as well.
- π¨πSwitzerland berdir Switzerland
What happens when you add translations? I suspect that a translation with a different info/label will result in a separate key, and then it gets unpredictable which one you actually end up with? Maybe add a default langcode condition?
FWIW, this feels like a misuse of aggregate queries to me, but it is obviously a big improvement, so...
- Status changed to Needs work
10 months ago 5:22am 26 January 2024 - Status changed to Needs review
10 months ago 6:52am 29 January 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
FWIW, this feels like a misuse of aggregate queries to me, but it is obviously a big improvement, so...
Can you elaborate on why, I do this fairly regularly in contrib and custom code. Trying to understand the implications.
Maybe add a default langcode condition?
Done
- π¨πSwitzerland berdir Switzerland
> Can you elaborate on why, I do this fairly regularly in contrib and custom code. Trying to understand the implications.
We always say that the only correct way to interact with entities is to load them, so that the appropriate hooks are running which *might* alter the data or also things like language negotiation*. We do not support any partial loading of field values or direct DB queries and an aggregate query is essentially that. Usually an aggregate query is combined with an aggregation function, where you count all nodes grouped by type or some other field and don't access the raw values. This is different.
*I just realized that this isn't working at all right now anyway, block content labels always show up in the default language only (we kind of implicitly assume in most plugin caches that all labels are t() objects and translated when accessed so we don't cache per language), that's not the case here. This is already not working in any useful way in HEAD, but I could imagine something like a ContentTranslation object that you feed with all the translations of a given content entity that then acts like a TranslatableMarkup object.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
We always say that the only correct way to interact with entities is to load them, so that the appropriate hooks are running which *might* alter the data or also things like language negotiation*
Thanks, I was thinking that might be the reason, so its good to get confirmation.
Does that mean that this approach is a BC break, because someone could be implementing a load hook for block content and modifying the titles? Do we need to put this behind a feature flag that's opt-in? Thoughts @catch with your RM hat on?
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
I'm not aware of how trash module works but I got a bug report for a contrib module that leads me to suspect it might unset entities in a load hook if they're trashed. That might be something that has a side effect here.
- Status changed to Needs work
9 months ago 7:23pm 8 February 2024 - πΊπΈUnited States smustgrave
Seems 10.2.3 is out. Should this go to 10.3?
- Assigned to catch
- π¨π¦Canada phjou Vancouver π¨π¦ πͺπΊ
Patch doesn't seem to apply anymore.
- First commit to issue fork.