-
Notifications
You must be signed in to change notification settings - Fork 128
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
Read min cluster version directly from DiscoveryNodes #581
Read min cluster version directly from DiscoveryNodes #581
Conversation
Signed-off-by: Martin Gaievski <[email protected]>
Codecov Report
@@ Coverage Diff @@
## feature/efficient-filtering #581 +/- ##
=================================================================
- Coverage 84.38% 84.09% -0.29%
+ Complexity 1055 1048 -7
=================================================================
Files 149 149
Lines 4316 4308 -8
Branches 384 382 -2
=================================================================
- Hits 3642 3623 -19
- Misses 499 508 +9
- Partials 175 177 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -49,20 +46,11 @@ public void initialize(final ClusterService clusterService) { | |||
*/ | |||
public Version getClusterMinVersion() { | |||
Version minVersion = Version.CURRENT; |
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.
Version minVersion = Version.CURRENT; | |
public Version getClusterMinVersion() { | |
try { | |
return this.clusterService.state().getNodes().getMinNodeVersion(); | |
} catch (Exception exception) { | |
log.error("Failed to get minimum node version of the cluster. Returning current node version instead.", exception); | |
return Version.CURRENT; | |
} | |
} |
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.
Trivial. Better not to change variable value once it is defined to reduce a chance of an error.
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.
ack
try { | ||
clusterDiscoveryNodes = this.clusterService.state().getNodes().getNodes(); | ||
minVersion = this.clusterService.state().getNodes().getMinNodeVersion(); | ||
} catch (Exception exception) { | ||
log.error("Cannot get cluster nodes", exception); |
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.
Error message needs to be updated.
Signed-off-by: Martin Gaievski <[email protected]>
9b32e17
into
opensearch-project:feature/efficient-filtering
…ject#581) * Simplify min cluster version lookup Signed-off-by: Martin Gaievski <[email protected]>
Signed-off-by: Martin Gaievski [email protected]
Description
Found simpler way of reading min deployed version for cluster, we can remove direct iteration over cluster nodes - https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/cluster/node/DiscoveryNodes.java#L399. Changing that for context of filtering feature.
Issues Resolved
#376
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.