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

Merged
merged 5 commits into from
Dec 23, 2024

Conversation

ameenhere
Copy link
Contributor

@ameenhere ameenhere commented Dec 21, 2024

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 SchemaDescriptors for TE,Enrollment,Event back. These are rightfully removed in v42 and not required there. However the old API still exists in v41 and relied on the existence of the SchemaDescriptors. 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.

@ameenhere ameenhere marked this pull request as ready for review December 23, 2024 11:53
@ameenhere ameenhere merged commit 8a6f820 into 2.41 Dec 23, 2024
15 checks passed
@ameenhere ameenhere deleted the DHIS2-18690-2.41 branch December 23, 2024 12:26
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.

2 participants