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

Add Remote Reindex SPI extension #547

Merged
merged 1 commit into from
May 6, 2021

Conversation

soosinha
Copy link
Member

Description

This change extends the remote reindex SPI to allow adding a custom interceptor.
This interceptor can be plugged in to perform any processing on the request or response like signing the request using IAM.

Issues Resolved

closes: #511

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

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.

@odfe-release-bot
Copy link

✅   DCO Check Passed c7a33e8ad58caf4e320e640494607541f1de458b

@odfe-release-bot
Copy link

✅   Gradle Wrapper Validation success c7a33e8ad58caf4e320e640494607541f1de458b

@odfe-release-bot
Copy link

✅   Gradle Precommit success c7a33e8ad58caf4e320e640494607541f1de458b

@nknize
Copy link
Collaborator

nknize commented Apr 15, 2021

start gradle check

@odfe-release-bot
Copy link

✅   Gradle Check success c7a33e8ad58caf4e320e640494607541f1de458b
Log 81

Reports 81

@peterzhuamazon
Copy link
Member

start dco check
start wrapper validation
start gradle precommit

@odfe-release-bot
Copy link

✅   Gradle Wrapper Validation success c7a33e8ad58caf4e320e640494607541f1de458b

@odfe-release-bot
Copy link

✅   DCO Check Passed c7a33e8ad58caf4e320e640494607541f1de458b

@odfe-release-bot
Copy link

✅   Gradle Precommit success c7a33e8ad58caf4e320e640494607541f1de458b

import org.opensearch.index.reindex.BulkByScrollResponse;
import org.opensearch.index.reindex.ReindexRequest;

public interface RemoteReindexExtension {
Copy link
Member

Choose a reason for hiding this comment

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

could we add additional tests using this extension?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no implementation that is added here. Only new interface has been added. Some of the methods have new parameters added to them which should be covered by the existing unit tests.

import org.opensearch.index.reindex.BulkByScrollResponse;
import org.opensearch.index.reindex.ReindexRequest;

public interface RemoteReindexExtension {
Copy link
Member

Choose a reason for hiding this comment

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

Shall we add some java doc here to clarify the intent of this extension point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added javadoc

if (remoteExtension.isPresent()) {
return remoteExtension.get().getRemoteReindexActionListener(listener, reindexRequest);
}
logger.error("Not able to load remote reindex metrics listener");
Copy link
Member

Choose a reason for hiding this comment

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

This error message seems confusing, in case there are no actual extensions present to the Reindexer plugin.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the message

Comment on lines 20 to 29
* Get a wrapper of ActionListener which is used to collect remote reindex metrics
* @return ActionListener wrapper implementation.
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep the comment more generic, as action listeners could serve more purpose than just the metrics.

Copy link
Member Author

Choose a reason for hiding this comment

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

Made the comment generic

@odfe-release-bot
Copy link

✅   Gradle Wrapper Validation success df5e90161387b43bc4644ec24740c0d90c4cf3ee

@odfe-release-bot
Copy link

✅   DCO Check Passed df5e90161387b43bc4644ec24740c0d90c4cf3ee

@odfe-release-bot
Copy link

✅   Gradle Precommit success df5e90161387b43bc4644ec24740c0d90c4cf3ee

@harold-wang
Copy link
Contributor

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure df5e90161387b43bc4644ec24740c0d90c4cf3ee
Log 152

Reports 152

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed c0836948b02743ee598b7af0c5173a127f9634f8

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success c0836948b02743ee598b7af0c5173a127f9634f8

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success c0836948b02743ee598b7af0c5173a127f9634f8

@harold-wang
Copy link
Contributor

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success c0836948b02743ee598b7af0c5173a127f9634f8
Log 153

Reports 153

Copy link
Contributor

@adnapibar adnapibar left a comment

Choose a reason for hiding this comment

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

LGTM

List<RemoteReindexExtension> remoteReindexExtensionList = new ArrayList<>();
iterable.forEach(remoteReindexExtensionList::add);
if (remoteReindexExtensionList.isEmpty()) {
logger.error("Unable to find any implementation for RemoteReindexExtension");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we logging an error here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to info log.

This change extends the remote reindex SPI to allow adding a custom interceptor.
This interceptor can be plugged in to perform any processing on the request or response.

Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 094e16e

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 094e16e

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 094e16e

@adnapibar
Copy link
Contributor

adnapibar commented May 6, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 094e16e
Log 164

Reports 164

@adnapibar adnapibar merged commit 181ee8a into opensearch-project:main May 6, 2021
@nknize nknize added the v2.0.0 Version 2.0.0 label May 6, 2021
@nknize
Copy link
Collaborator

nknize commented May 6, 2021

What version are you targeting? Do we want this in 1.0.0? If so you'll need to open a separate backport PR.

@nknize nknize added the enhancement Enhancement or improvement to existing feature or request label May 6, 2021
@soosinha
Copy link
Member Author

soosinha commented May 6, 2021

@nknize This is targetted for 1.0.0. Can you let me know the process for a backport PR ? What version would it be backported to as 1.0.0 is not yet released ?

@abbashus abbashus added the v1.0.0 Version 1.0.0 label May 21, 2021
abbashus added a commit that referenced this pull request May 21, 2021
This change extends the remote reindex SPI to allow adding a custom interceptor.
This interceptor can be plugged in to perform any processing on the request or response.

Signed-off-by: Sooraj Sinha <soosinha@amazon.com>

Co-authored-by: Sooraj Sinha <81695996+soosinha@users.noreply.github.com>
@abbashus abbashus mentioned this pull request Jul 12, 2021
5 tasks
abbashus added a commit that referenced this pull request Jul 12, 2021
Signed-off-by: Abbas Hussain <abbas_10690@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request v1.0.0 Version 1.0.0 v2.0.0 Version 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Remote Reindex plugin extensible for adding custom interceptor
10 participants