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

Handle exception for the updation of a replication rule #1405

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

skumarp7
Copy link
Contributor

Description

This PR handles the exception handling for updation of a replication rule.

Earlier behavior:

First hit of the replication rule:

curl -Method POST -Uri "http://localhost:9201/_plugins/_replication/_autofollow?pretty"  -H @{'Content-Type' = 'application/json'} -body '{"leader_alias":"leader", "name": "test3", "
pattern":"test*"}'


StatusCode        : 200
StatusDescription : OK
Content           : {
                      "acknowledged" : true
                    }

Second hit of the same Replication rule:

curl -Method POST -Uri "http://localhost:9201/_plugins/_replication/_autofollow?pretty"  -H @{'Content-Type' = 'application/json'} -body '{"leader_alias":"leader", "name": "test3", "
pattern":"test*"}'


StatusCode        : 200
StatusDescription : OK
Content           : {
                      "acknowledged" : true
                    }

New behavior:
First hit of the replication rule:

curl -Method POST -Uri "http://localhost:9201/_plugins/_replication/_autofollow?pretty"  -H @{'Content-Type' = 'application/json'} -body '{"leader_alias":"leader", "name": "test3", "
pattern":"test*"}'


StatusCode        : 200
StatusDescription : OK
Content           : {
                      "acknowledged" : true
                    }

Second hit of the Replication rule:

curl -Method POST -Uri "http://localhost:9201/_plugins/_replication/_autofollow?pretty"  -H @{'Content-Type' = 'application/json'} -body '{"leader_alias":"leader", "name": "test3", "
pattern":"log*"}' 

curl : { "error" : { "root_cause" : [ { "type" : "resource_already_exists_exception", "reason" : "task with id {autofollow:leader:test3} already exist" } ], "type" : "exception", "reason" : "Exisiting Autofollow replication     
    rule cannot be updated", "caused_by" : { "type" : "resource_already_exists_exception", "reason" : "task with id {autofollow:leader:test3} already exist" } }, "status" : 500 }

Issues Resolved

#1394

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.

@skumarp7
Copy link
Contributor Author

Hi @ankitkala & @monusingh-1 ,

Please provide feedback :)

Signed-off-by: Sanjay Kumar <[email protected]>
@skumarp7
Copy link
Contributor Author

skumarp7 commented Jun 25, 2024

Hi @ankitkala @monusingh-1 and other maintainers,

I could see the integTest is failing for the below test case -

org.opensearch.replication.integ.rest.StartReplicationIT > test operations are fetched from lucene when leader is in mixed mode FAILED
    org.opensearch.client.ResponseException: method [PUT], host [http://[::1]:34485], URI [_cluster/settings], status line [HTTP/1.1 400 Bad Request]
    {"error":{"root_cause":[{"type":"settings_exception","reason":"persistent setting [migration.direction], not recognized"}],"type":"settings_exception","reason":"persistent setting [migration.direction], not recognized"},"status":400}
        at __randomizedtesting.SeedInfo.seed([1A13834D768F0352:4342CA6FD3CA47EA]:0)
        at app//org.opensearch.client.RestClient.convertResponse(RestClient.java:385)
        at app//org.opensearch.client.RestClient.performRequest(RestClient.java:355)
        at app//org.opensearch.client.RestClient.performRequest(RestClient.java:330)
        at app//org.opensearch.replication.integ.rest.StartReplicationIT.test operations are fetched from lucene when leader is in mixed mode(StartReplicationIT.kt:1287)
REPRODUCE WITH: ./gradlew ':integTest' --tests "org.opensearch.replication.integ.rest.StartReplicationIT.test operations are fetched from lucene when leader is in mixed mode" -Dtests.seed=1A13834D768F0352 -Dtests.security.manager=true -Dtests.locale=smn-FI -Dtests.timezone=US/Samoa -Druntime.java=11

I was able to find a PR which involves the exclusion of this test case in integTestRemote Task but not in integTest.

#1379

I have for now excluded this particular test case from the integTest. Let me know if any other plan to fix this test case?

Copy link
Member

@ankitkala ankitkala left a comment

Choose a reason for hiding this comment

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

Mostly LGTM

build.gradle Outdated Show resolved Hide resolved
@ankitkala ankitkala enabled auto-merge (rebase) July 22, 2024 04:47
@ankitkala ankitkala merged commit 2da2034 into opensearch-project:main Jul 22, 2024
8 of 13 checks passed
@opensearch-trigger-bot
Copy link

The backport to 2.x failed:

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

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
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1405-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 2da20341107bfe707487d93d271df70aed31356d
# Push it to GitHub
git push --set-upstream origin backport/backport-1405-to-2.x
# Go back to the original working tree
cd ../..
# 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-1405-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