You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2024/02/23 19:27:35 UTC

(solr) branch branch_9x updated (8aaa68fb4d4 -> 5e7ebc6ec4b)

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

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


    from 8aaa68fb4d4 SOLR-16138: Throw when streaming and all cores are down (#784)
     new a6d94f21340 SOLR-17017: Reset the collection as part of running the example when starting Solr... (#2261)
     new 5e7ebc6ec4b formatting from backport of SOLR-17017

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:
 .../java/org/apache/solr/cli/RunExampleTool.java   | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)


(solr) 01/02: SOLR-17017: Reset the collection as part of running the example when starting Solr... (#2261)

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

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

commit a6d94f21340a5625e0ab2ea48aac676d075d905b
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Fri Feb 23 13:55:20 2024 -0500

    SOLR-17017: Reset the collection as part of running the example when starting Solr... (#2261)
    
    Provide some messaging about running an example via bin/solr start -e MYEXAMPLE and the example already exists warning the user that the state isnt' fresh!
---
 .../java/org/apache/solr/cli/RunExampleTool.java   | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
index 680a879372e..f6e81b57af5 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -259,15 +259,18 @@ public class RunExampleTool extends ToolBase {
 
     String solrUrl = (String) nodeStatus.get("baseUrl");
 
-    // safe check if core / collection already exists
+    // If the example already exists then let the user know they should delete it or
+    // they may get unusual behaviors.
     boolean alreadyExists = false;
-    if (nodeStatus.get("cloud") != null) {
-      if (SolrCLI.safeCheckCollectionExists(solrUrl, collectionName)) {
+    boolean cloudMode = nodeStatus.get("cloud") != null;
+    if (cloudMode) {
+      if (SolrCLI.safeCheckCollectionExists(
+          solrUrl, collectionName))) {
         alreadyExists = true;
         echo(
             "\nWARNING: Collection '"
                 + collectionName
-                + "' already exists!\nChecked collection existence using Collections API");
+                + "' already exists, which may make starting this example not work well!");
       }
     } else {
       String coreName = collectionName;
@@ -276,10 +279,17 @@ public class RunExampleTool extends ToolBase {
         echo(
             "\nWARNING: Core '"
                 + coreName
-                + "' already exists!\nChecked core existence using Core API command");
+                + "' already exists, which may make starting this example not work well!");
       }
     }
 
+    if (alreadyExists) {
+      echo(
+          "You may want to run 'bin/solr delete -c "
+              + collectionName
+              + "' first before running the example to ensure a fresh state.");
+    }
+
     if (!alreadyExists) {
       String[] createArgs =
           new String[] {
@@ -335,7 +345,7 @@ public class RunExampleTool extends ToolBase {
       }
     } else if ("films".equals(exampleName) && !alreadyExists) {
       try (SolrClient solrClient = new Http2SolrClient.Builder(solrUrl).build()) {
-        echo("Adding dense vector field type to films schema \"_default\"");
+        echo("Adding dense vector field type to films schema");
         SolrCLI.postJsonToSolr(
             solrClient,
             "/" + collectionName + "/schema",
@@ -349,8 +359,7 @@ public class RunExampleTool extends ToolBase {
                 + "        }\n"
                 + "      }");
 
-        echo(
-            "Adding name, initial_release_date, and film_vector fields to films schema \"_default\"");
+        echo("Adding name, initial_release_date, and film_vector fields to films schema");
         SolrCLI.postJsonToSolr(
             solrClient,
             "/" + collectionName + "/schema",


(solr) 02/02: formatting from backport of SOLR-17017

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

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

commit 5e7ebc6ec4b666b38bab7af92f4405e5b6e6f8af
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Fri Feb 23 14:27:29 2024 -0500

    formatting from backport of SOLR-17017
---
 solr/core/src/java/org/apache/solr/cli/RunExampleTool.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
index f6e81b57af5..dd3588ce706 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -264,8 +264,7 @@ public class RunExampleTool extends ToolBase {
     boolean alreadyExists = false;
     boolean cloudMode = nodeStatus.get("cloud") != null;
     if (cloudMode) {
-      if (SolrCLI.safeCheckCollectionExists(
-          solrUrl, collectionName))) {
+      if (SolrCLI.safeCheckCollectionExists(solrUrl, collectionName)) {
         alreadyExists = true;
         echo(
             "\nWARNING: Collection '"