This is an automated email from the ASF dual-hosted git repository.
cpoerschke pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new e0ce8f60da8 SOLR-17120: handle null value when merging partials (#2214)
e0ce8f60da8 is described below
commit e0ce8f60da8c97a765f598e9ee36438715e964f7
Author: Calvin Smith <[email protected]>
AuthorDate: Wed Jan 24 10:29:09 2024 -0800
SOLR-17120: handle null value when merging partials (#2214)
* 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
(cherry picked from commit 571c8871278bc14aea683420aea58ef64e38bbae)
---
solr/CHANGES.txt | 3 +++
solr/core/src/java/org/apache/solr/update/UpdateLog.java | 9 +++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b06caf88132..3d64b09e494 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -124,6 +124,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)
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
index c9301356a0c..c13530891fd 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -1020,8 +1020,13 @@ public class UpdateLog implements PluginInfoInitialized,
SolrMetricProducer {
// 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);
+ }
}
}
}