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

[Extensions]Add query for initialized extensions #5658

Merged
merged 13 commits into from
Jan 5, 2023

Conversation

mloufra
Copy link
Contributor

@mloufra mloufra commented Dec 29, 2022

Signed-off-by: Frank Lou [email protected]

Description

Create a feature to have an extension query to OpenSearch to obtain a list of initialized extensions and determine whether a particular extension is initialized.
Equivalent PR on OpenSearch-sdk-java : opensearch-project/opensearch-sdk-java#300

Issues Resolved

fixes opensearch-project/opensearch-sdk-java#149

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@mloufra mloufra changed the title [Extensions]Added query for initialized extensions [Extensions]Add query for initialized extensions Dec 29, 2022
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

Great progress. A few more tweaks needed.

}

public ExtensionRequest(StreamInput in) throws IOException {
super(in);
Copy link
Member

Choose a reason for hiding this comment

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

I believe Requests require the super(in) while responses do not. This should definitely match the writeTo implementation; I don't expect it will pass tests without it matching.

this(requestType, null);
}

public ExtensionRequest(ExtensionsManager.RequestType requestType, Optional<String> uniqueId) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't make the user provide an optional. Just take a @Nullable String parameter here, and then set this.uniqueId the same way you do in the stream constructor. Given the overloaded constructor above, this would set the optional to null and break things later.

}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExtensionRequest that = (ExtensionRequest) o;
return Objects.equals(requestType, that.requestType);
return Objects.equals(requestType, that.requestType) && uniqueId.equals(that.uniqueId);
Copy link
Member

Choose a reason for hiding this comment

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

(Style) use the same comparison format (either Objects.equals() or direct equals comparison) for both.

@@ -24,41 +25,53 @@
*/
public class ExtensionRequest extends TransportRequest {
private static final Logger logger = LogManager.getLogger(ExtensionRequest.class);
private ExtensionsManager.RequestType requestType;
private final ExtensionsManager.RequestType requestType;
private final Optional<String> uniqueId;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like there is no test class for ExtensionRequest so you should create one and include a test of this uniqueID, both in the null case (single arg constructor) or value present case (two arg constructor)

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2022

Codecov Report

Merging #5658 (cc1f2d9) into main (28e9b11) will decrease coverage by 0.01%.
The diff coverage is 56.52%.

@@             Coverage Diff              @@
##               main    #5658      +/-   ##
============================================
- Coverage     70.98%   70.97%   -0.02%     
- Complexity    58669    58685      +16     
============================================
  Files          4763     4765       +2     
  Lines        279945   280009      +64     
  Branches      40418    40430      +12     
============================================
+ Hits         198731   198738       +7     
- Misses        64988    65084      +96     
+ Partials      16226    16187      -39     
Impacted Files Coverage Δ
.../opensearch/extensions/DiscoveryExtensionNode.java 74.07% <0.00%> (-21.17%) ⬇️
...a/org/opensearch/test/OpenSearchIntegTestCase.java 56.90% <0.00%> (+0.23%) ⬆️
...a/org/opensearch/extensions/ExtensionsManager.java 52.45% <22.22%> (-1.59%) ⬇️
...pensearch/common/settings/FeatureFlagSettings.java 50.00% <50.00%> (ø)
...search/extensions/ExtensionDependencyResponse.java 71.42% <71.42%> (ø)
...va/org/opensearch/extensions/ExtensionRequest.java 75.00% <72.72%> (+45.58%) ⬆️
.../java/org/opensearch/common/util/FeatureFlags.java 80.00% <88.88%> (+30.00%) ⬆️
...org/opensearch/common/settings/SettingsModule.java 85.81% <100.00%> (+0.29%) ⬆️
server/src/main/java/org/opensearch/node/Node.java 87.17% <100.00%> (+0.01%) ⬆️
...g/opensearch/index/analysis/CharFilterFactory.java 0.00% <0.00%> (-100.00%) ⬇️
... and 505 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Gradle Check (Jenkins) Run Completed with:

@saratvemulapalli
Copy link
Member

@mloufra can you resolve conflicts with changelog.md?

Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
Signed-off-by: Frank Lou <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationIT.testDeleteOperations

@owaiskazi19 owaiskazi19 merged commit e24de72 into opensearch-project:main Jan 5, 2023
@mloufra mloufra deleted the query-for-extensions branch January 5, 2023 21:09
@ryanbogan ryanbogan added the backport 2.x Backport to 2.x branch label Jan 13, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-5658-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e24de72df5cc1ae7a44f84e216518b916f0c7cf5
# Push it to GitHub
git push --set-upstream origin backport/backport-5658-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-5658-to-2.x.

@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add support for ppc64le architecture ([#5459](https:/opensearch-project/OpenSearch/pull/5459))
- Added @gbbafna as an OpenSearch maintainer ([#5668](https:/opensearch-project/OpenSearch/pull/5668))
- Added support for feature flags in opensearch.yml ([#4959](https:/opensearch-project/OpenSearch/pull/4959))
- Add query for initialized extensions ([#5658](https:/opensearch-project/OpenSearch/pull/5658))
Copy link
Member

Choose a reason for hiding this comment

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

@owaiskazi19 Just a heads up, but since this change was to be backported and released in 2.x, this changelog entry should have gone in the [Unreleased 2.x] section of this file. I'm working on cleaning up the changelog on main right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Let an extension query OpenSearch for all initialized extensions
7 participants