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

Adding replication (CCR) plugin interface and classes to common-utils #667

Merged
merged 11 commits into from
Mar 4, 2025

Conversation

aggarwalShivani
Copy link
Contributor

Description

Background:

  • This change is required for a new feature being added in ism plugin - unfollow-action #726 - integrating ccr and ism plugins.
  • For this feature, ism plugin needs to invoke stop-replication action from ccr. As both ccr and ism need to invoke some common code, the common code can be moved to common-utils, as done previously for other plugins too. For ex. notifications plugin
  • As sharing of libraries also leads to a type-cast and class-loading issue - previously seen with notification plugin - the request object needs to be of a higher-level class from opensearch-core like ActionRequest and later be recreated into required type i.e. StopIndexReplicationRequest.

Proposed Solution:

  1. Common-utils: Move common code of stop-replication from ccr project to common-utils.
  2. CCR: Modify ccr plugin to consume classes from common-utils. Also, create a new TransportAction that transforms the request into required type and invokes TransportStopIndexReplicationAction.
  3. ISM: Add new action in ism
    (FYI - This is an alternative approach for this feature. I had also raised a draft PR with a different approach, but we didnt go ahead with it as it required changes in opensearch-core as well.)

Change description:
Code for StopIndexReplicationRequest and StopIndexReplicationAction are moved to common-utils. Added UTs for both the new classes added.
This PR caters to point 1 of the proposed solution.

Issues Resolved

Related Issues
unfollow-action #726

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.

Signed-off-by: aggarwalShivani <shivani.aggarwal@nokia.com>
aggarwalShivani and others added 2 commits July 8, 2024 16:31
aggarwalShivani and others added 2 commits January 29, 2025 17:39
@aggarwalShivani
Copy link
Contributor Author

Hi,
For this change, some CI failures are due to AcknowledgedResponse moving to org.opensearch.action.support.clustermanager. Will repush once the integration issue with common-utils, ccr, ism on main branch is resolved
As discussed with @bowenlan-amzn, raised backport PR on 2.x branch (#789).

@aggarwalShivani
Copy link
Contributor Author

Hi, For this change, some CI failures are due to AcknowledgedResponse moving to org.opensearch.action.support.clustermanager. Will repush once the integration issue with common-utils, ccr, ism on main branch is resolved As discussed with @bowenlan-amzn, raised backport PR on 2.x branch (#789).

Hi @bowenlan-amzn

The integration issue of common-utils and ccr is resolved with the merge of this change in ccr.
ISM continues to remain blocked though until this issue is resolved.

Meanwhile, as the changes for the stop-replication feature for both common-utlis and ccr are ready, requesting your review on this.
Backport PR is also ready for review #789

bowenlan-amzn
bowenlan-amzn previously approved these changes Feb 22, 2025
/**
* Transport action plugin interfaces for the cross-cluster-replication plugin.
*/
open class ReplicationPluginInterface {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
open class ReplicationPluginInterface {
object ReplicationPluginInterface {

Copy link
Member

Choose a reason for hiding this comment

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

Feels like the methods here should just be static methods.

Copy link
Contributor Author

@aggarwalShivani aggarwalShivani Mar 3, 2025

Choose a reason for hiding this comment

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

Thanks. After modifying the way UTs were written in ism, it didnt need to remain open anymore.
I've made this change now 👍

On 2.x branch, as the backport PR was already merged, I've raised a new PR for addressing this comment.

Signed-off-by: aggarwalShivani <shivani.aggarwal@nokia.com>
@aggarwalShivani
Copy link
Contributor Author

Hi @bowenlan-amzn
This change is ready for review, kindly review when possible. Once this gets merged, CI checks for the ccr and ism PRs could go through :)

@bowenlan-amzn bowenlan-amzn merged commit 5e086a2 into opensearch-project:main Mar 4, 2025
9 checks passed
@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:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/common-utils/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/common-utils/backport-2.x
# Create a new branch
git switch --create backport-667-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5e086a27ef844584499fdc15d7c15c9b47ad4420
# Push it to GitHub
git push --set-upstream origin backport-667-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/common-utils/backport-2.x

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants