-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Update TransportNodesCapabilitiesAction for V9 #122613
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4017eed
ES-10242 Update TransportNodesCapabilitiesAction for V9
alexey-ivanov-es f684653
Update docs/changelog/122613.yaml
alexey-ivanov-es 7842c07
[CI] Auto commit changes from spotless
8bfbb18
assert that restApiVersion is never null from request
alexey-ivanov-es c062353
Merge branch '8.x' into ES-10242_8.x
alexey-ivanov-es 675f2ae
Merge branch '8.x' into ES-10242_8.x
alexey-ivanov-es 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,5 @@ | ||
| pr: 122613 | ||
| summary: Update `TransportNodesCapabilitiesAction` for V9 | ||
| area: Infra/REST API | ||
| type: enhancement | ||
| issues: [] |
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
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
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 |
|---|---|---|
|
|
@@ -115,17 +115,19 @@ protected NodeCapability nodeOperation(NodeCapabilitiesRequest request, Task tas | |
| request.path, | ||
| request.parameters, | ||
| request.capabilities, | ||
| request.restApiVersion | ||
| request.restApiVersionMajor | ||
| ); | ||
| return new NodeCapability(supported, transportService.getLocalNode()); | ||
| } | ||
|
|
||
| public static class NodeCapabilitiesRequest extends TransportRequest { | ||
| private static final int IMPLICIT_REST_API_VERSION = 0; | ||
|
|
||
| private final RestRequest.Method method; | ||
| private final String path; | ||
| private final Set<String> parameters; | ||
| private final Set<String> capabilities; | ||
| private final RestApiVersion restApiVersion; | ||
| private final Byte restApiVersionMajor; | ||
|
|
||
| public NodeCapabilitiesRequest(StreamInput in) throws IOException { | ||
| super(in); | ||
|
|
@@ -134,7 +136,9 @@ public NodeCapabilitiesRequest(StreamInput in) throws IOException { | |
| path = in.readString(); | ||
| parameters = in.readCollectionAsImmutableSet(StreamInput::readString); | ||
| capabilities = in.readCollectionAsImmutableSet(StreamInput::readString); | ||
| restApiVersion = RestApiVersion.forMajor(in.readVInt()); | ||
| byte versionFromMessage = (byte) in.readVInt(); | ||
| // V9 can send IMPLICIT_REST_API_VERSION | ||
| restApiVersionMajor = (versionFromMessage != IMPLICIT_REST_API_VERSION) ? versionFromMessage : null; | ||
| } | ||
|
|
||
| public NodeCapabilitiesRequest( | ||
|
|
@@ -148,7 +152,9 @@ public NodeCapabilitiesRequest( | |
| this.path = path; | ||
| this.parameters = Set.copyOf(parameters); | ||
| this.capabilities = Set.copyOf(capabilities); | ||
| this.restApiVersion = restApiVersion; | ||
| assert restApiVersion != null; | ||
| // restApiVersionMajor can be null only if it is received as part of transport message from v9 node | ||
| this.restApiVersionMajor = restApiVersion.major; | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -159,7 +165,7 @@ public void writeTo(StreamOutput out) throws IOException { | |
| out.writeString(path); | ||
| out.writeCollection(parameters, StreamOutput::writeString); | ||
| out.writeCollection(capabilities, StreamOutput::writeString); | ||
| out.writeVInt(restApiVersion.major); | ||
| out.writeVInt(restApiVersionMajor); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8.18/8.19 send only 7 or 8 here, any other node they can form cluster with understands it |
||
| } | ||
| } | ||
| } | ||
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
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.
8.18/8.19 should be able to understand message sent by v9 node containing either 9 or 0