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
When creating content with devel generate module I noticed performance is degraded badly after more and more content is created.
The issue seems related to content that has references to other entities. The Drupal\Core\Field\Plugin\Field\FieldType::generateSampleValue
call to getReferenceableEntities without specify a limit of entities. And after creating a lot of nodes (+1000) it start to create Fatal errors.
Proposed resolution
Provide a when calling getReferenceableEntities
from generateSampleValue
to avoid fatal errors.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | limit-entity-reference-sample-values-2804595-8.patch | 1.72 KB | dagmar |
#6 | limit-entity-reference-sample-values-2804595-6.patch | 1.73 KB | dagmar |
#2 | limit-entity-reference-sample-values-2804595-2.patch | 944 bytes | dagmar |
Comments
Comment #2
dagmarComment #3
dagmarComment #4
dagmarComment #5
BerdirMakes sense to me. This is "just" default content, I don't think we want to test creating 1000 nodes to make sure it doesn't fail.
However, 10 is quite low. It means you will only get references to the same 10 nodes. Can we maybe add a random sort or something like that, or sort by id desc, so we always pick from the last 10 ids?
Comment #6
dagmarGood idea. What about this patch?
Comment #7
Berdirwe have the random value below, we don't need to fetch a random amount of values as well I think?
Comment #8
dagmarTrue! Thanks @berdir
Comment #9
BerdirWorks for me.
Comment #10
alexpottCommitted b1a178c and pushed to 8.3.x. Thanks!
Setting to patch to be ported for cherry-pick to 8.2.x once 8.2.0 is released.
Comment #12
jibran@Berdir do you think we need this for DER as well?
Comment #13
Berdirif you have the same logic implemented then yes, I guess so.
Comment #14
alexpottCommitted 2d63542 and pushed to 8.2.x. Thanks!