fix: [DHIS2-18690] Re-add TESchemaDescriptor to avoid in-memory query planner (2.41) #19553
+56
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Calle had complaned a simple enrollment api caused an OutOfMemory heap space error. On investigating, the culprit was the removal of
TrackedEntityInstanceSchemaDescriptor
removal. This meant the SchemaService would identify TrackedEntity as a "non persisted" entity and cause the queryPlanner in DefaultQueryService to use npQuery (non-persisted in-memory query) instead.This meant, whenever enrollment was done, as part of
prepareCaches
it loaded all the TEs (8 million in Calle's case) into the memory and did an in-memory filtering for the single TEI it was interested in. Thereby causing the OutOfMemory issue.This PR simply re-introduces the SchemaDescriptor back as TrackedEntitySchemaDescriptor. This is rightfully removed in v42 and not required there. However the old API still exists in v41 and relied on the existence of the SchemaDescriptor. Instead of changing any other logics, re-introduced it back which fixes the issue.