-
Notifications
You must be signed in to change notification settings - Fork 2
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
Optionally specify limit for number of entities in a record. #373
Conversation
This is a brute-force approach to dealing with OOM situations when Alma records have an excessive number of items (e.g. 99374518570506441: >12000 entities = ~10 GB heap for the Record instance). Use Metafix instance setter `setMaxEntityCount(int)` or set system property `org.metafacture.metafix.maxEntityCount=<int>`. Alternative options: - Increase maximum heap size for JVM. - Significantly reduce memory requirement for Record instances.
f70996f
to
1fed102
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. It prevents possible flooding, as we already experienced. So I like this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but should probably include a test.
Regarding test: As currently implemented, the feature cannot be exercised under test conditions because the limit is already set (system property already evaluated) before the test gets the chance to influence it. Either change the implementation to make it testable (keeping performance implications in mind) or skip test coverage in this case (assuming that this feature is only used in extremely rare edge cases). |
Adding a unit test proved to be quite messy when attempting to keep the instance member variable |
Just a proof-of-concept to gauge interest in such a feature; the immediate need has been rendered moot (due to the record's holdings being suppressed from publishing now).
This is a brute-force approach to dealing with OOM situations when Alma records have an excessive number of items (e.g. 99374518570506441: >12000 entities = ~10 GB heap for the Record instance). Loosely modeled after JAXP's
totalEntitySizeLimit
, except that we don't abort processing but instead skip the remaining entities.Use Metafix instance setterset system propertysetMaxEntityCount(int)
ororg.metafacture.metafix.maxEntityCount=<int>
.Alternative options:
Possible optimizations (implemented in dc4f1af):
static final
; this way the JVM can (potentially) eliminate the check altogether when no limit has been set (less than zero).literal()
.