Repository navigation
GH Issue 1591: Stream and batch updates for text choice values for better memory usage - #8121
Merged
Merged
Conversation
…tter memory usage
cnathe
approved these changes
Oct 1, 2026
cnathe
left a comment
Contributor
There was a problem hiding this comment.
Manual testing complete as well.
|
|
||
| private static final int TEXT_CHOICE_UPDATE_BATCH_SIZE = 1000; | ||
|
|
||
| private static void updateTextChoiceValueRows(Domain domain, User user, DomainProperty prop, Map<String, Object> valueUpdates, ValidationException errors) |
Contributor
There was a problem hiding this comment.
claude is suggesting that "In the caller loop, stop calling updateTextChoiceValueRows once validationException has errors." around line 1055. Since the outer save is rolled back when there are errors, this would just be doing extra work. This makes sense to me since I assume that we would only show the first error from within updateTextChoiceValueRows to the user anyway
Contributor
Author
There was a problem hiding this comment.
Good idea. Done.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale
Issue 1591 - When updating a text choice value (that is not a multi-choice value), we were keeping several copies of the rows to be updated in memory, which led to OOM issues for a sample type (or other domain) with millions of rows. This PR switches to using a stream of the rows and batching the updates to reduce the querying time as well as the memory usage.
Related Pull Requests
Changes