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

fix: [DHIS2-18690] Re-add TESchemaDescriptor to avoid in-memory query planner (2.41) #19553

Draft
wants to merge 2 commits into
base: 2.41
Choose a base branch
from

Conversation

ameenhere
Copy link
Contributor

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.

@ameenhere ameenhere marked this pull request as draft December 21, 2024 17:36
@ameenhere
Copy link
Contributor Author

Converting the PR to draft. @zubaira Rightly pointed out that ProgramInstance and ProgramStageInstance also had SchemaDescriptor which was removed in v41. Need to investigate this before the PR is considered complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant