Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8801

/bin/solr create script always returns exit code 0

    Details

      Description

      /bin/solr create collection script always returns exit code 0 when a collection already exists (solrCloud mode).
      version 5.1 returns exit code 1 but I just noticed that versions 5.4.0 and 5.5.0 returns 0

      >$ solr create -c my-collection -p 8983
      Connecting to ZooKeeper at localhost:9983 ...
      Re-using existing configuration directory my-collection
      ERROR:
      Collection 'my-collection' already exists!
      Checked collection existence using Collections API command:
      http://localhost:8983/solr/admin/collections?action=list
      >$ echo $?
      0

      1. SOLR_8801.patch
        2 kB
        Steve Rowe
      2. SOLR_8801.patch
        2 kB
        Marius Grama

        Activity

        Hide
        mariusneo Marius Grama added a comment - - edited

        Patch attached to this issue.

        Due to the fact that SolrCLI.CreateTool was delegating the job of creating the collection/core via SolrCLI.ToolBase#runTool(CommandLine) to the coresponding tool (CreateCollectionTool/CreateCoreTool), the exit code of the operation was being lost.

        Calling instead SolrCLI.ToolBase#runImpl(CommandLine) will generate an exception which will be caught in SolrCLI.ToolBase#runTool(CommandLine) and so, the invalid exit code status will be correctly returned when exiting from SolrCLI, while the functionality previously provided is still kept.

        Via SolrCloudExampleTest.java I've added new instructions to be used for verifying that a collection can't be created again, once that it exists. Unfortunately, the test case is annotated with @LuceneTestCase.BadApple reason why it won't be taken into account by the tests.

        Show
        mariusneo Marius Grama added a comment - - edited Patch attached to this issue. Due to the fact that SolrCLI.CreateTool was delegating the job of creating the collection/core via SolrCLI.ToolBase#runTool(CommandLine) to the coresponding tool (CreateCollectionTool/CreateCoreTool), the exit code of the operation was being lost. Calling instead SolrCLI.ToolBase#runImpl(CommandLine) will generate an exception which will be caught in SolrCLI.ToolBase#runTool(CommandLine) and so, the invalid exit code status will be correctly returned when exiting from SolrCLI, while the functionality previously provided is still kept. Via SolrCloudExampleTest.java I've added new instructions to be used for verifying that a collection can't be created again, once that it exists. Unfortunately, the test case is annotated with @LuceneTestCase.BadApple reason why it won't be taken into account by the tests.
        Hide
        ctargett Cassandra Targett added a comment -

        Edited to remove fixVersion - 5.1 was released a long time ago, and fixVersion is for when the issue is released.

        Show
        ctargett Cassandra Targett added a comment - Edited to remove fixVersion - 5.1 was released a long time ago, and fixVersion is for when the issue is released.
        Hide
        gerlowskija Jason Gerlowski added a comment -

        +1. Patch looks good to me. Seems like a simple but helpful change.

        Show
        gerlowskija Jason Gerlowski added a comment - +1. Patch looks good to me. Seems like a simple but helpful change.
        Hide
        steve_rowe Steve Rowe added a comment -

        LGTM.

        Attached patch makes a small adjustment to how the tool implementation is instantiated and called, but otherwise is the same. Also adds a CHANGES.txt entry.

        Committing shortly.

        Show
        steve_rowe Steve Rowe added a comment - LGTM. Attached patch makes a small adjustment to how the tool implementation is instantiated and called, but otherwise is the same. Also adds a CHANGES.txt entry. Committing shortly.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b922033517a8bf0cb0c7d8c1ab9a25fad57855c6 in lucene-solr's branch refs/heads/master from Steve Rowe
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b922033 ]

        SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists

        Show
        jira-bot ASF subversion and git services added a comment - Commit b922033517a8bf0cb0c7d8c1ab9a25fad57855c6 in lucene-solr's branch refs/heads/master from Steve Rowe [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b922033 ] SOLR-8801 : /bin/solr create script always returns exit code 0 when a collection/core already exists
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b4d8e42a1f0044c4d0a20967c2ec48b393eff39d in lucene-solr's branch refs/heads/branch_6x from Steve Rowe
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b4d8e42 ]

        SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists

        Show
        jira-bot ASF subversion and git services added a comment - Commit b4d8e42a1f0044c4d0a20967c2ec48b393eff39d in lucene-solr's branch refs/heads/branch_6x from Steve Rowe [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b4d8e42 ] SOLR-8801 : /bin/solr create script always returns exit code 0 when a collection/core already exists
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 02a5e15212429ed25e0a52744195a6406b37c8ab in lucene-solr's branch refs/heads/branch_6_0 from Steve Rowe
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=02a5e15 ]

        SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists

        Show
        jira-bot ASF subversion and git services added a comment - Commit 02a5e15212429ed25e0a52744195a6406b37c8ab in lucene-solr's branch refs/heads/branch_6_0 from Steve Rowe [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=02a5e15 ] SOLR-8801 : /bin/solr create script always returns exit code 0 when a collection/core already exists
        Hide
        steve_rowe Steve Rowe added a comment -

        Thanks Khalid, Marius and Jason!

        Show
        steve_rowe Steve Rowe added a comment - Thanks Khalid, Marius and Jason!
        Hide
        steve_rowe Steve Rowe added a comment -

        Bulk close issues included in the 6.0.1 release.

        Show
        steve_rowe Steve Rowe added a comment - Bulk close issues included in the 6.0.1 release.
        Hide
        steve_rowe Steve Rowe added a comment -

        Reopening to backport to 5.6 and 5.5.2.

        Show
        steve_rowe Steve Rowe added a comment - Reopening to backport to 5.6 and 5.5.2.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit f249b61dcb3e36a75bb75115a3fc3c8daa969721 in lucene-solr's branch refs/heads/branch_5_5 from Steve Rowe
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f249b61 ]

        SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists

        Show
        jira-bot ASF subversion and git services added a comment - Commit f249b61dcb3e36a75bb75115a3fc3c8daa969721 in lucene-solr's branch refs/heads/branch_5_5 from Steve Rowe [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f249b61 ] SOLR-8801 : /bin/solr create script always returns exit code 0 when a collection/core already exists
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 77e7fbbaa37223e91f2adae9829ef48c689286ea in lucene-solr's branch refs/heads/branch_5x from Steve Rowe
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=77e7fbb ]

        SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists

        Show
        jira-bot ASF subversion and git services added a comment - Commit 77e7fbbaa37223e91f2adae9829ef48c689286ea in lucene-solr's branch refs/heads/branch_5x from Steve Rowe [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=77e7fbb ] SOLR-8801 : /bin/solr create script always returns exit code 0 when a collection/core already exists
        Hide
        steve_rowe Steve Rowe added a comment -

        Bulk close issues released with 5.5.2.

        Show
        steve_rowe Steve Rowe added a comment - Bulk close issues released with 5.5.2.

          People

          • Assignee:
            steve_rowe Steve Rowe
            Reporter:
            kalharbi Khalid Alharbi
          • Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1m
              1m
              Remaining:
              Remaining Estimate - 1m
              1m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development