Skip to content

Commit

Permalink
SOLR-17120: handle null value when merging partials (#2214)
Browse files Browse the repository at this point in the history
* SOLR-17120 handle null value when merging partials

  - this change avoids a `NullPointerException` that can occur
    under some circumstances when performing multiple partial
    updates of the same document
  • Loading branch information
eukaryote authored Jan 24, 2024
1 parent f8160eb commit 571c887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Bug Fixes

* SOLR-17074: Fixed not correctly escaped quote in bin/solr script (Dominique Béjean, Vincenzo D'Amore)

* SOLR-17120: Fix NullPointerException in UpdateLog.applyOlderUpdates that can occur if there are multiple partial
updates of the same document in separate requests using commitWithin. (Calvin Smith, Christine Poerschke)

Dependency Upgrades
---------------------
* SOLR-17012: Update Apache Hadoop to 3.3.6 and Apache Curator to 5.5.0 (Kevin Risden)
Expand Down
9 changes: 7 additions & 2 deletions solr/core/src/java/org/apache/solr/update/UpdateLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,13 @@ private void applyOlderUpdates(
// if the newerDoc has this field, then this field from olderDoc can be ignored
if (!newerDoc.containsKey(fieldName)
&& (mergeFields == null || mergeFields.contains(fieldName))) {
for (Object val : olderDoc.getFieldValues(fieldName)) {
newerDoc.addField(fieldName, val);
Collection<Object> values = olderDoc.getFieldValues(fieldName);
if (values == null) {
newerDoc.addField(fieldName, null);
} else {
for (Object val : values) {
newerDoc.addField(fieldName, val);
}
}
}
}
Expand Down

0 comments on commit 571c887

Please sign in to comment.