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

Use lazy fetch in MavenResolverIO when reading POMs from the DB #472

Merged
merged 4 commits into from
Jun 13, 2022

Conversation

mir-am
Copy link
Contributor

@mir-am mir-am commented Jun 8, 2022

Description

Specifically, this PR makes the following changes:

  • Use JOOQ's lazyFetch() in readFromDB() to avoid loading lots of table rows in a list and causing OOM.
  • Set JDBC AutoCommit to false when creating a PG connection in the REST API. This is needed as PG doesn't like non-zero fetch size and autocommit == false together. See this for more info.

Motivation and context

As described in #471, the Java REST API currently crashes due to OOM, which is caused by reading all package versions' metadata into memory. This should be done lazily, i.e., one by one.

Testing

Tested with the DC and within the IDE.
Also, with this fix, in production, the Java REST API is now responsive and the OOM exception does not occur.

@mir-am mir-am added the enhancement New feature or request label Jun 8, 2022
@mir-am mir-am self-assigned this Jun 8, 2022
@mir-am mir-am requested a review from proksch June 8, 2022 12:28
Copy link
Contributor

@proksch proksch left a comment

Choose a reason for hiding this comment

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

After the clarifications in the call, this change looks good to me

@mir-am mir-am merged commit da0ccaf into develop Jun 13, 2022
@mir-am mir-am deleted the lazy-fetch-mvn-resolver-io branch June 13, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants