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

thelabdude 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 10fb66f  SOLR-15832: Clean-up after publish action in Schema Designer 
shouldn't fail if .system collection doesn't exist (#451)
10fb66f is described below

commit 10fb66fcfc9de2ba4a149416d5e0c20c01acc943
Author: Timothy Potter <[email protected]>
AuthorDate: Wed Dec 8 13:01:13 2021 -0700

    SOLR-15832: Clean-up after publish action in Schema Designer shouldn't fail 
if .system collection doesn't exist (#451)
---
 solr/CHANGES.txt                                        |  2 ++
 .../apache/solr/handler/designer/SchemaDesignerAPI.java | 17 ++++++++++++-----
 .../handler/designer/SchemaDesignerConfigSetHelper.java |  5 +++--
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ff3f0fb..b35eb73 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -472,6 +472,8 @@ Bug Fixes
 
 * SOLR-15833: Enable exists queries on spatial types. (Mike Drob, Houston 
Putman)
 
+* SOLR-15832: Clean-up after publish action in Schema Designer shouldn't fail 
if .system collection doesn't exist (Timothy Potter)
+
 ==================  8.11.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this 
release.
diff --git 
a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java 
b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
index 4eb26b2..14f97ba 100644
--- a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
+++ b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
@@ -512,7 +512,12 @@ public class SchemaDesignerAPI implements 
SchemaDesignerConstants {
     }
 
     if (req.getParams().getBool(CLEANUP_TEMP_PARAM, true)) {
-      cleanupTemp(configSet);
+      try {
+        cleanupTemp(configSet);
+      } catch (IOException | SolrServerException | SolrException exc) {
+        final String excStr = exc.toString();
+        log.warn("Failed to clean-up temp collection {} due to: {}", 
mutableId, excStr);
+      }
     }
 
     settings.setDisabled(req.getParams().getBool(DISABLE_DESIGNER_PARAM, 
false));
@@ -769,11 +774,9 @@ public class SchemaDesignerAPI implements 
SchemaDesignerConstants {
       Optional<SchemaField> maybeSchemaField = 
schemaSuggester.suggestField(normalizedField, sampleValues, schema, langs);
       maybeSchemaField.ifPresent(fieldsToAdd::add);
     }
-
     if (!fieldsToAdd.isEmpty()) {
       schema = (ManagedIndexSchema) schema.addFields(fieldsToAdd);
     }
-    
     return schema;
   }
 
@@ -799,6 +802,7 @@ public class SchemaDesignerAPI implements 
SchemaDesignerConstants {
               "Schema '" + configSet + "' is locked for edits by the schema 
designer!");
         }
         publishedVersion = configSetHelper.getCurrentSchemaVersion(configSet);
+        log.info("Opening temp copy of {} as {} with publishedVersion {}", 
configSet, mutableId, publishedVersion);
         // ignore the copyFrom as we're making a mutable temp copy of an 
already published configSet
         copyConfig(configSet, mutableId);
         copyFrom = null;
@@ -1138,8 +1142,11 @@ public class SchemaDesignerAPI implements 
SchemaDesignerConstants {
           mutableId + " configSet not found! Are you sure " + configSet + " 
was being edited by the schema designer?");
     }
 
-    // check the versions agree
-    configSetHelper.checkSchemaVersion(mutableId, 
requireSchemaVersionFromClient(req), -1);
+    final int schemaVersionInZk = 
configSetHelper.getCurrentSchemaVersion(mutableId);
+    if (schemaVersionInZk != -1) {
+      // check the versions agree
+      configSetHelper.checkSchemaVersion(mutableId, 
requireSchemaVersionFromClient(req), schemaVersionInZk);
+    } // else the stored is -1, can't really enforce here
 
     return mutableId;
   }
diff --git 
a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
 
b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
index ee71a00..a6a3365 100644
--- 
a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
+++ 
b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
@@ -460,8 +460,9 @@ class SchemaDesignerConfigSetHelper implements 
SchemaDesignerConstants {
   void deleteStoredSampleDocs(String configSet) {
     try {
       cloudClient().deleteByQuery(BLOB_STORE_ID, "id:" + configSet + 
"_sample/*", 10);
-    } catch (IOException | SolrServerException exc) {
-      log.warn("Failed to delete sample docs from blob store for {}", 
configSet, exc);
+    } catch (IOException | SolrServerException | SolrException exc) {
+      final String excStr = exc.toString();
+      log.warn("Failed to delete sample docs from blob store for {} due to: 
{}", configSet, excStr);
     }
   }
 

Reply via email to