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] Adding versioning support for registering Rest actions #7302

Conversation

saratvemulapalli
Copy link
Member

Description

Moving RestActions request to Protobuf to support cross version compatibility.
Also this PR adds ExtensionIdentity as an abstract data container for Identity of extension.
In the follow up PR's I'll move over all places where uniqueId to use ExtensionIdentity.

Issues Resolved

Part of #7402
Also moves the needle for opensearch-project/opensearch-sdk-java#702

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.

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@saratvemulapalli
Copy link
Member Author

Gradle Check (Jenkins) Run Completed with:

[org.opensearch.indices.replication.SegmentReplicationIT.testReplicaHasDiffFilesThanPrimary](https://build.ci.opensearch.org/job/gradle-check/14550/testReport/junit/org.opensearch.indices.replication/SegmentReplicationIT/testReplicaHasDiffFilesThanPrimary/)
[org.opensearch.indices.replication.SegmentReplicationIT.testReplicaHasDiffFilesThanPrimary](https://build.ci.opensearch.org/job/gradle-check/14550/testReport/junit/org.opensearch.indices.replication/SegmentReplicationIT/testReplicaHasDiffFilesThanPrimary_2/)
[org.opensearch.indices.replication.SegmentReplicationIT.testReplicaHasDiffFilesThanPrimary](https://build.ci.opensearch.org/job/gradle-check/14550/testReport/junit/org.opensearch.indices.replication/SegmentReplicationIT/testReplicaHasDiffFilesThanPrimary_3/)
[org.opensearch.indices.replication.SegmentReplicationIT.testReplicaHasDiffFilesThanPrimary](https://build.ci.opensearch.org/job/gradle-check/14550/testReport/junit/org.opensearch.indices.replication/SegmentReplicationIT/testReplicaHasDiffFilesThanPrimary_4/)

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@dblock
Copy link
Member

dblock commented Apr 26, 2023

Looks good, but I expected some tests to have to change as well.

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.

LGTM but left a comment about future-proofing for a known feature request that we should consider doing.

.setIdentity(identity)
.addAllRestActions(restActions)
.addAllDeprecatedRestActions(deprecatedRestActions)
.build();
Copy link
Member

Choose a reason for hiding this comment

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

I haven't had time to follow up with a thorough design, but I think there may need to be one more bit of information passed from the extension here, and it would be nice to do it with this PR rather than a separate one.

It relates to SDK #355 and replaced/deprecated routes. Basically:

  • we want the deprecated routes coming from the extensions to be verbatim (with /_plugin prefix) without making any changes on OpenSearch side (but with possible exception handling if the plugin is installed and the prefix is already taken, per the linked issue)
  • we want active/new routes coming from the extension to use the uniqueId and /_extension prefix but also possibly register with a /_plugin prefix, per the linked issue.

So we may want to actually include some sort of "prefix" string.

This may be exactly what you are doing with ExtensionIdentity but I'm thinking perhaps that may need a second string argument.

Sorry this isn't fully thought out, but perhaps something we should all agree on (and possibly implement SDK #355 shortly after this).

Copy link
Member

Choose a reason for hiding this comment

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

(To be clear, my suggestion is to add a second string field to Identity, so it would have a uniqueID and a prefix.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Had a chat with @dbwiddis, we'll add a new bool in a different PR to solve it.
Will try to get this PR merged as the framework.

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented May 2, 2023

Codecov Report

Merging #7302 (91dd606) into main (1151308) will increase coverage by 0.13%.
The diff coverage is 70.83%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main    #7302      +/-   ##
============================================
+ Coverage     70.56%   70.69%   +0.13%     
- Complexity    59547    59594      +47     
============================================
  Files          4876     4876              
  Lines        285813   285816       +3     
  Branches      41162    41162              
============================================
+ Hits         201686   202065     +379     
+ Misses        67519    67122     -397     
- Partials      16608    16629      +21     
Impacted Files Coverage Δ
...va/org/opensearch/extensions/ExtensionRequest.java 68.00% <40.00%> (-2.84%) ⬇️
...ch/extensions/rest/RegisterRestActionsRequest.java 75.00% <78.94%> (+5.76%) ⬆️

... and 462 files with indirect coverage changes

@saratvemulapalli
Copy link
Member Author

Looks good, but I expected some tests to have to change as well.

Thanks for the review. Added few tests. Could you take a look again @dblock

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.search.SearchWeightedRoutingIT.testSearchAggregationWithNetworkDisruption_FailOpenEnabled
      1 org.opensearch.index.remote.RemoteRefreshSegmentPressureServiceTests.testValidateSegmentUploadLag

@saratvemulapalli saratvemulapalli added extensions backport 2.x Backport to 2.x branch labels May 2, 2023
@saratvemulapalli saratvemulapalli merged commit 7c3c411 into opensearch-project:main May 2, 2023
@saratvemulapalli saratvemulapalli deleted the restactions-protobuf branch May 2, 2023 22:52
@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-7302-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7c3c411becfea1933f93bfce4e411c189757a06e
# Push it to GitHub
git push --set-upstream origin backport/backport-7302-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-7302-to-2.x.

saratvemulapalli added a commit to saratvemulapalli/OpenSearch that referenced this pull request May 2, 2023
…pensearch-project#7302)

Add cross version support for register Rest Actions for extensions

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
@kotwanikunal
Copy link
Member

@saratvemulapalli I just pulled this commit into my local workspace and I faced a compile error for missing classes.
I ran ./gradlew generateProto which seemed to have resolved the issue, but I think we should document it as a part of the dev guide.

@saratvemulapalli
Copy link
Member Author

saratvemulapalli commented May 3, 2023

@saratvemulapalli I just pulled this commit into my local workspace and I faced a compile error for missing classes. I ran ./gradlew generateProto which seemed to have resolved the issue, but I think we should document it as a part of the dev guide.

My bad, absolutely. I'll send out a PR.
Also Im curious how did you compile? generateProto is a dependent task for compileJava

@kotwanikunal
Copy link
Member

@saratvemulapalli I just pulled this commit into my local workspace and I faced a compile error for missing classes. I ran ./gradlew generateProto which seemed to have resolved the issue, but I think we should document it as a part of the dev guide.

My bad, absolutely. I'll send out a PR. Also Im curious how did you compile? generateProto is a dependent task for compileJava

Strange. I was trying to run a test directly on IntelliJ and it did not auto compile.

saratvemulapalli added a commit that referenced this pull request May 3, 2023
…7302) (#7373)

Add cross version support for register Rest Actions for extensions

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…pensearch-project#7302)

Add cross version support for register Rest Actions for extensions

Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
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 extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants