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 and cpoerschke committed Jan 25, 2024
1 parent f13b673 commit 9cd5c11
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 @@ -42,6 +42,9 @@ Bug Fixes
* SOLR-17098: ZK Credentials and ACLs are no longer sent to all ZK Servers when using Streaming Expressions.
They will only be used when sent to the default ZK Host. (Houston Putman, Jan Høydahl, David Smiley, Gus Heck, Qing Xu)

* 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)

Optimizations
---------------------
* SOLR-16555: SolrIndexSearcher - FilterCache intersections/andNot should not clone bitsets repeatedly (Kevin Risden, David Smiley)
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 @@ -959,8 +959,13 @@ private void applyOlderUpdates(@SuppressWarnings({"rawtypes"})SolrDocumentBase n
for (String fieldName : olderDoc.getFieldNames()) {
// 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 9cd5c11

Please sign in to comment.