You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/09/30 19:34:17 UTC

(solr) branch branch_9x updated (b93fd43622a -> c1df2315673)

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

dsmiley pushed a change to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


    from b93fd43622a changelog changes2html.py: fix author extraction swallowing trailing title text, and multi-issue items not all linking
     new 746cc59e7a8 SOLR-18303: Stop backup cleanup from hiding the original failure (#4776)
     new c1df2315673 SOLR-18197: NestPathField: tolerate legacy maxCharsForDocValues arg (#4964)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...8303-incremental-backup-cleanup-masks-error.yml |  8 ++
 .../solr/cloud/api/collections/BackupCmd.java      | 12 ++-
 .../cloud/api/collections/DeleteBackupCmd.java     | 14 ++--
 .../java/org/apache/solr/schema/NestPathField.java |  2 +
 .../solr/collection1/conf/schema-nest.xml          |  3 +-
 .../cloud/api/collections/DeleteBackupCmdTest.java | 92 ++++++++++++++++++++++
 6 files changed, 122 insertions(+), 9 deletions(-)
 create mode 100644 changelog/unreleased/SOLR-18303-incremental-backup-cleanup-masks-error.yml
 create mode 100644 solr/core/src/test/org/apache/solr/cloud/api/collections/DeleteBackupCmdTest.java


(solr) 02/02: SOLR-18197: NestPathField: tolerate legacy maxCharsForDocValues arg (#4964)

Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit c1df23156730a55815a9291ef281ad69ef13bdec
Author: David Smiley <ds...@apache.org>
AuthorDate: Wed Sep 30 14:56:26 2026 -0400

    SOLR-18197: NestPathField: tolerate legacy maxCharsForDocValues arg (#4964)
    
    Co-authored-by: Claude Opus 5.5 <no...@anthropic.com>
    (cherry picked from commit 70c1a28995dd95ee23b6726f9aed81e2843de41f)
    (cherry picked from commit a6204cebabd01330c1f9744c40bf46dd21b8c414)
---
 solr/core/src/java/org/apache/solr/schema/NestPathField.java   | 2 ++
 solr/core/src/test-files/solr/collection1/conf/schema-nest.xml | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/schema/NestPathField.java b/solr/core/src/java/org/apache/solr/schema/NestPathField.java
index be454c79ea4..344c7fc8b8d 100644
--- a/solr/core/src/java/org/apache/solr/schema/NestPathField.java
+++ b/solr/core/src/java/org/apache/solr/schema/NestPathField.java
@@ -49,6 +49,8 @@ public class NestPathField extends StrField {
     args.putIfAbsent("docValues", "true"); // flip a default; necessary for old schemas
     args.putIfAbsent("multiValued", "false"); // flip a default; necessary for old schemas
     args.putIfAbsent("uninvertible", "false"); // flip a default; necessary for old schemas
+    // Schema API persisted this when NestPathField extended SortableTextField (Solr <= 9.10)
+    args.remove("maxCharsForDocValues");
     super.setArgs(schema, args);
     // Doesn't support these flags; perhaps others too.
     // note: we could support STORED if truly useful but why bother given docValues.
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-nest.xml b/solr/core/src/test-files/solr/collection1/conf/schema-nest.xml
index 86775a6c61c..94573d662cb 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-nest.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-nest.xml
@@ -41,7 +41,8 @@
 
   <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
 
-  <fieldType name="_nest_path_" class="solr.NestPathField" />
+  <!-- Legacy attributes: as persisted by the Schema API in Solr 9.10 and earlier -->
+  <fieldType name="_nest_path_" class="solr.NestPathField" omitTermFreqAndPositions="true" omitNorms="true" maxCharsForDocValues="-1" multiValued="false" stored="false"/>
 
   <!-- Point Fields -->
   <fieldType name="int" class="solr.IntPointField"/>


(solr) 01/02: SOLR-18303: Stop backup cleanup from hiding the original failure (#4776)

Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 746cc59e7a8f6f9e3118939899ef30ecde01d85a
Author: Prithvi S <pr...@gmail.com>
AuthorDate: Tue Sep 15 21:52:36 2026 +0530

    SOLR-18303: Stop backup cleanup from hiding the original failure (#4776)
    
    Signed-off-by: prithvi <pr...@gmail.com>
    (cherry picked from commit 84f0da56682bd2dc545731448c456125f1828b70)
    (cherry picked from commit 5cc54854331cfde6bf19e05b6bdac3acbd8b6a2f)
---
 ...8303-incremental-backup-cleanup-masks-error.yml |  8 ++
 .../solr/cloud/api/collections/BackupCmd.java      | 12 ++-
 .../cloud/api/collections/DeleteBackupCmd.java     | 14 ++--
 .../cloud/api/collections/DeleteBackupCmdTest.java | 92 ++++++++++++++++++++++
 4 files changed, 118 insertions(+), 8 deletions(-)

diff --git a/changelog/unreleased/SOLR-18303-incremental-backup-cleanup-masks-error.yml b/changelog/unreleased/SOLR-18303-incremental-backup-cleanup-masks-error.yml
new file mode 100644
index 00000000000..73132e57536
--- /dev/null
+++ b/changelog/unreleased/SOLR-18303-incremental-backup-cleanup-masks-error.yml
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Incremental backup failures now report the original error instead of an unrelated missing zk_backup directory exception
+type: fixed
+authors:
+  - name: Prithvi S
+links:
+  - name: SOLR-18303
+    url: https://issues.apache.org/jira/browse/SOLR-18303
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java
index 151cbeeee1a..60f8287f70a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/BackupCmd.java
@@ -129,8 +129,16 @@ public class BackupCmd implements CollApiCmds.CollectionApiCommand {
                     "Error happened during incremental backup for collection: {}",
                     collectionName,
                     e);
-                CollectionHandlingUtils.cleanBackup(
-                    repository, backupUri, backupMgr.getBackupId(), ccc);
+                try {
+                  CollectionHandlingUtils.cleanBackup(
+                      repository, backupUri, backupMgr.getBackupId(), ccc);
+                } catch (Exception cleanupException) {
+                  log.warn(
+                      "Unable to clean up incomplete backup for collection: {}",
+                      collectionName,
+                      cleanupException);
+                  e.addSuppressed(cleanupException);
+                }
                 throw e;
               }
             } else {
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteBackupCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteBackupCmd.java
index aa6c8f9ef5b..8456a169b0b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteBackupCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteBackupCmd.java
@@ -25,6 +25,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.net.URI;
+import java.nio.file.NoSuchFileException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -207,13 +208,14 @@ public class DeleteBackupCmd implements CollApiCmds.CollectionApiCommand {
             .map(ShardBackupId::getBackupMetadataFilename)
             .collect(Collectors.toList()));
     repository.delete(incBackupFiles.getIndexDir(), unusedFiles);
-    try {
-      for (BackupId backupId : backupIdsDeletes) {
-        repository.deleteDirectory(
-            repository.resolveDirectory(backupUri, BackupFilePaths.getZkStateDir(backupId)));
+    for (BackupId backupId : backupIdsDeletes) {
+      URI zkStateDir =
+          repository.resolveDirectory(backupUri, BackupFilePaths.getZkStateDir(backupId));
+      try {
+        repository.deleteDirectory(zkStateDir);
+      } catch (FileNotFoundException | NoSuchFileException e) {
+        // zk_backup_* is created after shard copy, so a failed incremental backup may not have it
       }
-    } catch (FileNotFoundException e) {
-      // ignore this
     }
 
     // add details to result before deleting backupPropFiles
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/DeleteBackupCmdTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/DeleteBackupCmdTest.java
new file mode 100644
index 00000000000..5d01b5ce3af
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/DeleteBackupCmdTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.cloud.api.collections;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.backup.BackupFilePaths;
+import org.apache.solr.core.backup.BackupId;
+import org.apache.solr.core.backup.repository.BackupRepository;
+import org.apache.solr.core.backup.repository.LocalFileSystemRepository;
+import org.junit.Before;
+import org.junit.Test;
+
+/** Unit tests for {@link DeleteBackupCmd}. */
+public class DeleteBackupCmdTest extends SolrTestCase {
+
+  private BackupRepository repository;
+  private URI backupUri;
+
+  @Before
+  public void setUpRepo() throws Exception {
+    repository = new LocalFileSystemRepository();
+    backupUri =
+        repository.createDirectoryURI(
+            createTempDir("backup_" + UUID.randomUUID()).toAbsolutePath().toString());
+    new BackupFilePaths(repository, backupUri).createIncrementalBackupFolders();
+  }
+
+  @Test
+  public void testDeleteBackupIdsIgnoresMissingZkStateDir() throws Exception {
+    NamedList<Object> results = new NamedList<>();
+    new DeleteBackupCmd(null)
+        .deleteBackupIds(backupUri, repository, Set.of(BackupId.zero()), results);
+
+    assertNotNull(results.get("deleted"));
+    assertFalse(repository.exists(zkStateDir(BackupId.zero())));
+  }
+
+  @Test
+  public void testDeleteBackupIdsRemovesExistingZkStateDir() throws Exception {
+    URI zkStateDir = zkStateDir(BackupId.zero());
+    repository.createDirectory(zkStateDir);
+    assertTrue(repository.exists(zkStateDir));
+
+    new DeleteBackupCmd(null)
+        .deleteBackupIds(backupUri, repository, Set.of(BackupId.zero()), new NamedList<>());
+
+    assertFalse(repository.exists(zkStateDir));
+  }
+
+  @Test
+  public void testDeleteBackupIdsPropagatesUnexpectedDeleteErrors() {
+    BackupRepository failingRepository =
+        new LocalFileSystemRepository() {
+          @Override
+          public void deleteDirectory(URI path) throws IOException {
+            throw new IOException("simulated repository failure");
+          }
+        };
+
+    IOException thrown =
+        expectThrows(
+            IOException.class,
+            () ->
+                new DeleteBackupCmd(null)
+                    .deleteBackupIds(
+                        backupUri, failingRepository, Set.of(BackupId.zero()), new NamedList<>()));
+    assertEquals("simulated repository failure", thrown.getMessage());
+  }
+
+  private URI zkStateDir(BackupId backupId) {
+    return repository.resolveDirectory(backupUri, BackupFilePaths.getZkStateDir(backupId));
+  }
+}