Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/solr in branch_9_7 has commands that fail #2710

Merged
merged 16 commits into from
Sep 28, 2024

Conversation

epugh
Copy link
Contributor

@epugh epugh commented Sep 13, 2024

https://issues.apache.org/jira/browse/SOLR-XXXXX

Description

Fixes some bugs that existing in branch_9_7.

  • -p port numbers
  • bin/solr healthcheck is broken

This has good stuff to port back to main and branch_9x...

Tests

New Bats tests added

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@epugh
Copy link
Contributor Author

epugh commented Sep 13, 2024

Look at that! in 9.6, -V is passed in as verbose to the CreateTool. https://github.com/apache/solr/blob/branch_9_6/solr/bin/solr#L1185

This is generating some other refactorings which will be fun to bring to main and 9x seperately!
@epugh
Copy link
Contributor Author

epugh commented Sep 13, 2024

Found that HealthcheckTool isn't working in 9.7 either.. and our Bats test doesn't refute the right "ERROR", only "error" ;-).

@epugh epugh requested a review from janhoy September 13, 2024 18:20
@epugh epugh changed the title Re-introduce support for -p and -port Re-introduce support for -p and -port in bin/solr create and bin/solr delete. Fix bin/solr healthcheck. Sep 13, 2024
@epugh epugh changed the title Re-introduce support for -p and -port in bin/solr create and bin/solr delete. Fix bin/solr healthcheck. Fix bugs in bin/solr in branch_9_7 Sep 13, 2024
@epugh
Copy link
Contributor Author

epugh commented Sep 13, 2024

Okay, I think this is ready for review and commit. I am thinking that I move the bats tests in another PR to branch_9x to see what breaks there, and then do a PR to fix branch_9x. Then, I take the good stuff here and apply it to main... Versus doing it the other way...

Copy link
Contributor

@janhoy janhoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for quick PR. Looking good, not taken it for a spin, but very nice with the BATS tests.

Will we need edit to solr.cmd you think?

try (var solrClientForCollection = SolrCLI.getSolrClient(coreUrl)) {

// SolrCLI.getSolrClient converts the coreUrl back into a root Solr url, but we need to
// talk to specific core so manually creating the client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would you say this is a bug, or is it well documented in the javadoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm..... I read it and it says:

  /**
   * Get a SolrClient for the given URL. The URL can be with or without /solr suffix, the method
   * will normalize it and add '/solr'. To support certain unit tests, the hostContext can be
   * overridden via the system property 'hostContext'.
   *
   * <p>Note that from Solr 10.0 Solr will use / as base URL to support /api and other contexts, so
   * handling of hostContext differs between Solr 9.x and 10.x.
   *
   * @param solrUrl the base URL of Solr
   * @return a SolrClient initialized with correct hostContext, default '/solr'
   */
  public static SolrClient getSolrClient(String solrUrl) {

I think this is the only place we need a core specific url... Do you think it should support that use case as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked a bit more at the code, and decided to go with the javadoc approach!

solr/core/src/java/org/apache/solr/cli/ToolBase.java Outdated Show resolved Hide resolved
solr assert --started http://localhost:${SOLR_PORT} --timeout 5000

run solr create -c COLL_NAME -V
assert_output --partial "Created new core 'COLL_NAME'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not this assert a string that is only printed in verbose mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question... I think for core, you got this message, and for collection, you got a different dump (that was more like the api response). I changed it so that both core and collection output a short message like this, and then if you add the -v then you ALSO see the api responses... Does this work for you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I just expected the assert to fail without the -V, which it won't now since the text asserted is always printed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally understand what you mean, and am looking at it and then will merge.

solr/packaging/test/test_delete_collection.bats Outdated Show resolved Hide resolved
solr/packaging/test/test_healthcheck.bats Show resolved Hide resolved
@epugh
Copy link
Contributor Author

epugh commented Sep 18, 2024

Thanks for quick PR. Looking good, not taken it for a spin, but very nice with the BATS tests.

Will we need edit to solr.cmd you think?

Checked and yes, we had to fix healthcheck in solr.cmd.

@epugh
Copy link
Contributor Author

epugh commented Sep 18, 2024

@janhoy I've gone through and addressed (hopefully!) all your commits. Can I get a LGTM?

Copy link
Contributor

@malliaridis malliaridis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small additions from my side.

Comment on lines +168 to +169
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be eventually

Suggested change
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE_DEPRECATED);
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE,
SolrCLI.OPTION_VERBOSE_DEPRECATED);

Comment on lines +143 to +144
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE_DEPRECATED);
Copy link
Contributor

@malliaridis malliaridis Sep 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE_DEPRECATED);
SolrCLI.OPTION_ZKHOST_DEPRECATED,
SolrCLI.OPTION_VERBOSE,
SolrCLI.OPTION_VERBOSE_DEPRECATED);

solr/packaging/test/test_create.bats Outdated Show resolved Hide resolved
@gus-asf
Copy link
Contributor

gus-asf commented Sep 28, 2024

Can we update the title of this? is it just about CLI stuff? hard to know what this is about...

@epugh epugh changed the title Fix bugs in bin/solr in branch_9_7 bin/solr in branch_9_7 has commands that fail Sep 28, 2024
@epugh epugh merged commit 21a6b4c into apache:branch_9_7 Sep 28, 2024
3 of 4 checks passed
@epugh
Copy link
Contributor Author

epugh commented Sep 28, 2024

This was committed into branch_9x in #35ae5f7c55c27f463db048b975d06ec070fbbeef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants