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:46:40 UTC

[solr] branch main 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 main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 6350eb53955 SOLR-16877: Allow empty ZK data in Backup (#1764)
6350eb53955 is described below

commit 6350eb53955639da1d1da60cf77d0ef440d9094d
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
---
 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 04e21853dfb..5c974d076d5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -316,6 +316,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);
           }