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-17337: Show proper distributed stage id #2526

Closed
wants to merge 2 commits into from

Conversation

tboeghk
Copy link
Contributor

@tboeghk tboeghk commented Jun 19, 2024

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

Description

When showing track debug for custom stages in distributed requests, the stage id is not translated into a meaningful string. It is displayed as an empty string (see attachment). Furthermore, if you have multiple custom stages, the details for the most recent stage is displayed. The details for other stages is omitted.

Solution

If a given stage has no translation in the stage map, we format it's name in the format STAGE_<STAGE_ID>. By doing so, no stage details are omitted, even if you have multiple custom stages.

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

- Shows a proper distributed stage id instead of
  an empty string
@epugh
Copy link
Contributor

epugh commented Jun 19, 2024

Triggered the GitHub jobs. Is this too trivial to need a test?

@tboeghk
Copy link
Contributor Author

tboeghk commented Jun 20, 2024

There's only one valid answer to this, I'll add a test 👍

@epugh
Copy link
Contributor

epugh commented Jun 20, 2024

I think it really ends up being an integration test showing the behavior works?

@github-actions github-actions bot added the tests label Jun 23, 2024
@tboeghk
Copy link
Contributor Author

tboeghk commented Jun 23, 2024

I added a simple resolution test. Testing the distributed behaviour would mean adding a new test Solr configuration and adding a new test component that actually does a couple of distributed requests in custom stages :-/

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding the test, it also helps me understand what all is expected!

Will leave open for a few days to see if I get another reivew or concerns, and then look to merge later this week!

@epugh epugh self-assigned this Jun 23, 2024
@epugh
Copy link
Contributor

epugh commented Jun 23, 2024

I assigned it to me so I don't loose track of it!

@@ -181,16 +183,28 @@ public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest
}
}

@VisibleForTesting
static String getDistributedStageName(int stage) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor/subjective: making this non-static so that custom debug components could override to use an alternative (more meaningful) stage name

Suggested change
static String getDistributedStageName(int stage) {
protected String getDistributedStageName(int stage) {

Copy link
Contributor

Choose a reason for hiding this comment

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

#2594 opened with the changes in this PR plus making the new method protected with matching test changes.

@cpoerschke
Copy link
Contributor

I added a simple resolution test. Testing the distributed behaviour would mean adding a new test Solr configuration ...

The config APIs could be used instead of having another test Solr configuration -- e.g. https://github.com/apache/solr/blob/releases/solr/9.6.1/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java -- but yeah that would be quite a bit of code compared to a simple resolution test.

@epugh
Copy link
Contributor

epugh commented Jun 24, 2024

I think we need a gw tidy ;-)


@Test
public void testDistributedStageResolution() throws IOException {
assertEquals("PARSE_QUERY", DebugComponent.getDistributedStageName(ResponseBuilder.STAGE_PARSE_QUERY));
Copy link
Contributor

@cpoerschke cpoerschke Jul 23, 2024

Choose a reason for hiding this comment

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

gradlew tidy

Suggested change
assertEquals("PARSE_QUERY", DebugComponent.getDistributedStageName(ResponseBuilder.STAGE_PARSE_QUERY));
assertEquals("PARSE_QUERY",
DebugComponent.getDistributedStageName(ResponseBuilder.STAGE_PARSE_QUERY));

edit: I just tried to in-browser add the tidy fix here but it won't let me, likely because the branch is from an org rather than user fork of the repo, known git issue somewhere.

@tboeghk - would you have a moment to press "commit suggestion" here? thanks!

@cpoerschke
Copy link
Contributor

closing in favour of #2594 variant

@cpoerschke cpoerschke closed this Jul 29, 2024
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.

3 participants