Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Prevent cache overflow when querying nodes by related entities #4877

Merged
merged 1 commit into from Feb 7, 2024

Conversation

Sebobo
Copy link
Member

@Sebobo Sebobo commented Feb 7, 2024

Without this change new cache entries in Flow_Persistence_Doctrine are generated for each entry in the relationMap causing massive slowdowns in Neos f.e. when many assets are deleted as the file system cache cannot handle large numbers of entries well.

With this change only one entry per number of relations is generated which is usually only a few and the entries can be reused.

Resolves: #4876

Without this change new cache entries in Flow_Persistence_Doctrine
are generated for each entry in the relationMap causing massive slowdowns
in Neos f.e. when many assets are deleted as the file system cache
cannot handle large numbers of entries well.

With this change only one entry per number of relations is generated
which is usually only a few and the entries can be reused.

Resolves: #4876
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 by 👀

@@ -1710,24 +1710,29 @@ protected function buildQueryBuilderForRelationMap($relationMap)
$constraints = [];
$parameters = [];

// Use a counter to avoid parameter name conflicts and limit query metadata cache entries to the maximum number of relations
$identifierIndex = 0;

foreach ($relationMap as $relatedObjectType => $relatedIdentifiers) {
foreach ($relatedIdentifiers as $relatedIdentifier) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could probably just use the array key from here? but I guess fine for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so, as we have two loops.

@Sebobo Sebobo merged commit 38dc075 into 8.3 Feb 7, 2024
9 checks passed
@Sebobo Sebobo deleted the bugfix/query-cache-overflow branch February 7, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants