You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2023/07/10 14:52:15 UTC

[solr] branch branch_9x updated: SOLR-16877: Allow empty ZK data in Backup (#1764)

This is an automated email from the ASF dual-hosted git repository.

houston 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 f9510c0fdae SOLR-16877: Allow empty ZK data in Backup (#1764)
f9510c0fdae is described below

commit f9510c0fdaeb9147bc731498ec4132791fc1246c
Author: paulb <pa...@search-solutions.net>
AuthorDate: Fri Jul 7 17:09:14 2023 +0200

    SOLR-16877: Allow empty ZK data in Backup (#1764)
    
    Fixes #1764
    
    (cherry picked from commit 6350eb53955639da1d1da60cf77d0ef440d9094d)
---
 solr/CHANGES.txt                                                  | 2 ++
 solr/core/src/java/org/apache/solr/core/backup/BackupManager.java | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0e006d3e098..0954a2b3f42 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -282,6 +282,8 @@ Bug Fixes
 
 * SOLR-16861: Coordinator node does not have the correct collection/core in MDCLoggingContext (Patson Luk)
 
+* SOLR-16877: BackupManager now allows ConfigSet "files" to be empty, which previously caused NPEs. (Paul Blanchaert via Houston Putman)
+
 Dependency Upgrades
 ---------------------
 * PR#1494: Upgrade forbiddenapis to 3.5 (Uwe Schindler)
diff --git a/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java b/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
index e193928214a..be6a1a83c2f 100644
--- a/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
+++ b/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
@@ -345,6 +345,10 @@ public class BackupManager {
           log.debug("Writing file {}", filePath);
           // ConfigSetService#downloadFileFromConfig requires '/' in fle path separator
           byte[] data = configSetService.downloadFileFromConfig(configName, filePath);
+          // replace empty zk node (data==null) with empty array
+          if (data == null) {
+            data = new byte[0];
+          }
           try (OutputStream os = repository.createOutput(uri)) {
             os.write(data);
           }