Skip to content

SOLR-13681: make Lucene's index sorting directly configurable in Solr#313

Draft
cpoerschke wants to merge 22 commits into
apache:mainfrom
cpoerschke:SOLR-13681
Draft

SOLR-13681: make Lucene's index sorting directly configurable in Solr#313
cpoerschke wants to merge 22 commits into
apache:mainfrom
cpoerschke:SOLR-13681

Conversation

@cpoerschke

@cpoerschke cpoerschke commented Sep 28, 2021

Copy link
Copy Markdown
Contributor

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

see also https://issues.apache.org/jira/browse/SOLR-17310 scribbles w.r.t. potentially combining "within segment sorting" (e.g. this PR) and "between segments sorting" (e.g. @weiwang19's #2477 PR) in one configuration element

@janhoy janhoy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great.

Add a CHANGES entry. I may try to re-format the RefGuide edits from the patch later...

Comment thread solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java Outdated
final Sort expected = new Sort(new SortField(expectedFieldName, expectedFieldType, expectedFieldSortDescending));
final Sort actual = sortingMergePolicy.getSort();
assertEquals("SortingMergePolicy.getSort", expected, actual);
assertEquals("indexSort", expected, iwc.getIndexSort());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's create a new test method for the new config option, which will survive removal of SMP. Instead of creating yet another solrconfig-xyz.xml I think it should be possible to let the test invoke config-api to set the new setting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I would also favour not creating yet another solrconfig-xyz.xml file. Have used the config-api in tests before but from my research done so far it seems indexConfig is not yet supported by it, or rather 'get' works but 'set' does not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also interestingly V2 'get' works but V1 does not, for indexConfig but not for (say) requestHandler

  • both work
curl "http://localhost:8983/solr/gettingstarted/config/requestHandler"
curl "http://localhost:8983/api/collections/gettingstarted/config/requestHandler"
  • latter works, former does not
curl "http://localhost:8983/solr/gettingstarted/config/indexConfig"
curl "http://localhost:8983/api/collections/gettingstarted/config/indexConfig"

https://solr.apache.org/guide/8_10/config-api.html#retrieving-the-config lists indexConfig as available top-level section.

$ curl "http://localhost:8983/solr/gettingstarted/config/indexConfig"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/solr/gettingstarted/config/indexConfig</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>
</table>

</body>
</html>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, perhaps they are R/O because it is not supported to change these after collection creation?
In that case, a new xml file is probably better anyway.

Are you planning to validate that index sorting is working in the test, or simply that the config is set? I think perhaps a new method in the existing IndexConfig test would be enough?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, and perhaps changing some indexConfig parameters after collection creation would be fine but not so for others. Also the merge policy (factory) configuration is nested, not sure if config-api would easily support that.

Added a new method, modelled on the existing sorting-merge-policy one that will go away with sorting merge policy. There is existing TestSegmentSorting coverage w.r.t. index sorting working in a test, so it might make sense to tap into that somehow?

Comment on lines +178 to +181
if (cmd.getSegmentTerminateEarly()) {
final Sort cmdSort = cmd.getSort();
final int cmdLen = cmd.getLen();
final Sort mergeSort = core.getSolrCoreState().getMergePolicySort();
final Sort mergeSort = core.getSolrCoreState().getMergePolicySort(); // TODO: need this account for indexSort also?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://issues.apache.org/jira/browse/SOLR-15390 is about deprecating the segmentTerminateEarly flag.

Comment thread solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java Outdated
@cpoerschke

Copy link
Copy Markdown
Contributor Author

Great.

Add a CHANGES entry. I may try to re-format the RefGuide edits from the patch later...

Thanks for attaching SOLR-13681-refguide-skel.patch to the JIRA ticket!

If you wish, Allow edits and access to secrets by maintainers is enabled for this pull request, feel free to add documentation or code or test change commits directly to the pull request branch here.

@janhoy

janhoy commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

Sorry for going silent on this, I'll put it on my radar for next week.

Resolved Conflicts:
	solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
Resolved Conflicts:
	solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
	solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java
	solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
@janhoy
janhoy requested a review from atris May 7, 2024 12:14
@atris

atris commented May 9, 2024

Copy link
Copy Markdown
Contributor

@cpoerschke I am about to pick this up and start a fresh PR since this one has gotten stale. Is it ok if I proceed? I will ensure that the PR is marked for your review and you are credited as co author.

Resolved Conflicts:
	solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
@cpoerschke

Copy link
Copy Markdown
Contributor Author

@cpoerschke I am about to pick this up and start a fresh PR since this one has gotten stale. Is it ok if I proceed? I will ensure that the PR is marked for your review and you are credited as co author.

@atris - wonderful, yes please proceed. Also I've just resolved the (trivial) merge conflict on this PR and "allow edits by maintainers" is enabled for the PR i.e. as an alternative to a fresh PR you'd also be welcome to add commits to the PR's branch if you like.

@atris

atris commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

Still working on this - have a PR in process. Will publish by weekend and tag you for review

@HoustonPutman

Copy link
Copy Markdown
Contributor

@cpoerschke is there anything this needs to get over the line? I can help if so.

@cpoerschke

Copy link
Copy Markdown
Contributor Author

@cpoerschke is there anything this needs to get over the line? I can help if so.

Thanks @HoustonPutman!

From what I (very vaguely) recall there were details around "what if this is enabled for an existing collection" to be figured out, either programmatically somehow or perhaps via documentation. https://issues.apache.org/jira/browse/SOLR-13681 on 02-Sep-2020 has a cross-reference to https://issues.apache.org/jira/browse/SOLR-12239 around this, though no doubt things might have changed since etc.

If you or anyone else has bandwidth to help here that would be wonderful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants