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

SOLR-16911: Remove ability to change hostContext, keep it as /solr #1810

Merged
merged 15 commits into from
Aug 5, 2023

Conversation

epugh
Copy link
Contributor

@epugh epugh commented Jul 28, 2023

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

Description

Discovered during work on on SolrCLI that we support different hostContext than /solr. Remove that.

Solution

Please provide a short description of the approach taken to implement your solution.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

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)
  • 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 epugh marked this pull request as draft July 28, 2023 12:58
@epugh
Copy link
Contributor Author

epugh commented Jul 28, 2023

Locally at least all the bats tests pass except for test_placement_plugin.bats who may actually be a bit flaky...

@epugh epugh requested a review from HoustonPutman July 28, 2023 19:38
@@ -258,8 +258,8 @@ public void testCancelElection() throws Exception {
Thread.sleep(1000);

String urlScheme = zkStateReader.getClusterProperty(URL_SCHEME, "http");
String url1 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/1", urlScheme) + "/";
String url2 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/2", urlScheme) + "/";
String url1 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/1", urlScheme) + "/" + "1" + '/';
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 have some concerns about how this test works.... I kind of worked around it, however the naming of the urls for leader election seemed "odd".

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on why this fixes it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, I actually am worried this entire idea may fail.. At least the way I read this test, when we do leaderelection, we name our nodes {some_ip}/solr/1 and {same_ip}/solr/2 and {same_ip}/solr/3 and then something happens. However, I don't know if that is ACTUALLY how it happens, or maybe just how this test was written, since I've never dug into leader election in any way.... I also was wondering if maybe we need some sort of .bats test of leader election to prove that this change didn't break leader election in the real world.. I mean, technically this LeaderElectionTest.java passes... but...

Copy link
Contributor

Choose a reason for hiding this comment

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

@psalagnac WDYT of the changes to this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for tagging @psalagnac... I think getting this resolved is the last thing that needs doing... I am wondering if I need to create some sort of .bats test that validates the happy path of leaderelection...?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pining me on this.

This is related to other David's comment on the path removal in Utils.getBaseUrlForNodeName.

The change in the test does not make sense to me since the core name is here twice, but it is only once in the result URL. We just want to build the core url from the node base URL. I think it should be like this:

    String url1 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr", urlScheme) + "/1/";

@epugh epugh marked this pull request as ready for review July 28, 2023 19:41
}
return out;
static String generateNodeName(final String hostName, final String hostPort) {
return hostName + ':' + hostPort + '_' + "solr";
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd love to consider dropping the _solr here but this may need to be a 10.0 only thing. Deserves a JIRA issue if we can get this committed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah if this happens it should be a separate jira and definitely only be Solr 10x. I think leaving it would be fine, but a discussion for a different PR anyways

solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java Outdated Show resolved Hide resolved
@@ -258,8 +258,8 @@ public void testCancelElection() throws Exception {
Thread.sleep(1000);

String urlScheme = zkStateReader.getClusterProperty(URL_SCHEME, "http");
String url1 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/1", urlScheme) + "/";
String url2 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/2", urlScheme) + "/";
String url1 = Utils.getBaseUrlForNodeName("127.0.0.1:80_solr/1", urlScheme) + "/" + "1" + '/';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on why this fixes it?

solr/solrj/src/java/org/apache/solr/common/util/Utils.java Outdated Show resolved Hide resolved
Copy link

@henrik242 henrik242 left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -712,7 +712,7 @@ public static String getBaseUrlForNodeName(
}
final String hostAndPort = nodeName.substring(0, _offset);
final String path = URLDecoder.decode(nodeName.substring(1 + _offset), UTF_8);
Copy link
Contributor

@psalagnac psalagnac Aug 3, 2023

Choose a reason for hiding this comment

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

If we don't use path anymore, this line could be removed.
[EDIT] Nevermind, I wasn't looking at the latest version.

@epugh
Copy link
Contributor Author

epugh commented Aug 4, 2023

@dsmiley @psalagnac all the tests pass. Thoughts on comittting this?

@epugh epugh merged commit 9c911e7 into apache:main Aug 5, 2023
3 checks passed
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.

5 participants