-
Notifications
You must be signed in to change notification settings - Fork 817
SOLR-16458: Migrate NodeHealthAPI from homegrown @EndPoint to JAX-RS #4171
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
Merged
+712
−353
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0585c2a
Initial plan
Copilot 4aa9e8b
Migrate NodeHealthAPI from @EndPoint to JAX-RS annotations
Copilot 8e2ccd5
Add NodeHealthAPITest2: integration tests without Mockito mocks
Copilot a50f682
Restore logic to HealthCheckHandler, simplify NodeHealthAPI, update r…
Copilot b8159ab
restore docs
epugh 01696e3
lint
epugh dac4e14
Keep the non mock version
epugh ec8252a
Responding to feedback
epugh b592322
lint
epugh ca88d6e
add changelog
epugh 0809a34
Improve changelog
epugh 55bf2ce
Use the name healthcheck
epugh abea29c
Use enum for status and proper HTTP SolrJ classes in testing.
epugh 9c52897
WIP of hacking this guy up to work with enum :-(
epugh b47383b
Merge remote-tracking branch 'upstream/main' into copilot/migrate-nod…
epugh ff53a9d
Restore the exception raised on error behavior that v1 apis had
epugh 2d0c50b
better title
epugh 1452364
Flip delegation: move health-check logic to NodeHealthAPI, HealthChec…
Copilot 71feb02
Migrate business logic into NodeHealthAPI, and fix enum issue
epugh 2a81e9e
Follow the existing naming pattern.
epugh fc6ee9e
Add test for failure cases.
epugh 1b7c709
Merge remote-tracking branch 'upstream/main' into copilot/migrate-nod…
epugh e9e6c02
Nicer coding style
epugh 3f5e8ab
Nicer assert style.
epugh 4a5fb4d
Updates from merging latest code in.
epugh ee3cc2a
use assertThat
epugh bec1201
Migrate to hamcrest, and use standalone not legacy terms.
epugh aecb703
Split up standalone versus cloud mode tests.
epugh 3b48bdd
clearer changelog
epugh e44c779
Expose maxGenerationLag as a V2 query parameter on /api/node/health
Copilot a029f9c
docs: add maxGenerationLag monitoring section to replication ref guide
Copilot df5c6f9
better name
epugh 3165c6e
Merge branch 'copilot/migrate-node-health-api' of github.com:epugh/so…
epugh fc7c7cf
Responding to feedback
epugh 71a778d
Post discussion with jason...
epugh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| title: "SolrJ now offers a SolrRequest class allowing users to perform v2 single-node healthchecks: NodeApi.Healthcheck" | ||
| type: added | ||
| authors: | ||
| - name: Eric Pugh | ||
| - name: Jason Gerlowski | ||
| links: | ||
| - name: SOLR-16458 | ||
| url: https://issues.apache.org/jira/browse/SOLR-16458 | ||
43 changes: 43 additions & 0 deletions
43
solr/api/src/java/org/apache/solr/client/api/endpoint/NodeHealthApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.solr.client.api.endpoint; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import jakarta.ws.rs.GET; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.QueryParam; | ||
| import org.apache.solr.client.api.model.NodeHealthResponse; | ||
|
|
||
| /** V2 API definition for checking the health of a Solr node. */ | ||
| @Path("/node/health") | ||
| public interface NodeHealthApi { | ||
|
|
||
| @GET | ||
| @Operation( | ||
| summary = "Determine the health of a Solr node.", | ||
| tags = {"node"}) | ||
| NodeHealthResponse healthcheck( | ||
| @QueryParam("requireHealthyCores") Boolean requireHealthyCores, | ||
| @Parameter( | ||
| description = | ||
| "Maximum number of index generations a follower replica may lag behind its" | ||
| + " leader before the health check reports FAILURE. Only relevant when" | ||
| + " running in Standalone mode with leader/follower replication.") | ||
| @QueryParam("maxGenerationLag") | ||
| Integer maxGenerationLag); | ||
| } |
36 changes: 36 additions & 0 deletions
36
solr/api/src/java/org/apache/solr/client/api/model/NodeHealthResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.solr.client.api.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** Response body for the '/api/node/health' endpoint. */ | ||
| public class NodeHealthResponse extends SolrJerseyResponse { | ||
|
|
||
| /** The possible health statuses for a Solr node. */ | ||
| public enum NodeStatus { | ||
| OK, | ||
| FAILURE | ||
| } | ||
|
|
||
| @JsonProperty public NodeStatus status; | ||
|
|
||
| @JsonProperty public String message; | ||
|
|
||
| @JsonProperty("num_cores_unhealthy") | ||
| public Integer numCoresUnhealthy; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Q] (General question; not PR specific)
Is it our convention to add reviewers here as well?
I'm all for that but it'd be great to document in
dev-docs/changelog.adocif that's a convention we'd like to cement!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added you because you went beyond review, I mean, this PR chagned a lot....! Just causeyou didn't type characters doens't mean you didn't have a lot of input! I think you authored this as much as I did.