Apache Solr open-source search software
SOLR-15832: Clean-up after publish action in Schema Designer shouldn't fail if .system collection doesn't exist (#451)
Timothy Potter10fb66fcfc9d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ff3f0fb9b42..b35eb739d34 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.javaindex 4eb26b2125c..14f97ba8a50 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 configSetcopyConfig(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 herereturn 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.javaindex ee71a0056fb..a6a336589c8 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);}}