Skip to content

[Backport 2.x] [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica#4396

Merged
dreamer-89 merged 2 commits intoopensearch-project:2.xfrom
dreamer-89:mch2_updateTargetService_2x
Sep 5, 2022
Merged

[Backport 2.x] [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica#4396
dreamer-89 merged 2 commits intoopensearch-project:2.xfrom
dreamer-89:mch2_updateTargetService_2x

Conversation

@dreamer-89
Copy link
Copy Markdown
Member

Manul backport of #4363 to 2.x

…d primary on onNewCheckpoint on replica (opensearch-project#4363)

* [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica

Signed-off-by: Suraj Singh <surajrider@gmail.com>

* Add changelog entry

Signed-off-by: Suraj Singh <surajrider@gmail.com>

* Address review comments

Signed-off-by: Suraj Singh <surajrider@gmail.com>

* Address review comments 2

Signed-off-by: Suraj Singh <surajrider@gmail.com>

* Test failures

Signed-off-by: Suraj Singh <surajrider@gmail.com>

Signed-off-by: Suraj Singh <surajrider@gmail.com>
@dreamer-89 dreamer-89 requested review from a team and reta as code owners September 2, 2022 20:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 2, 2022

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 2, 2022

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.61%. Comparing base (b202fd1) to head (495d8e6).
⚠️ Report is 2756 commits behind head on 2.x.

Files with missing lines Patch % Lines
...s/replication/SegmentReplicationTargetService.java 81.81% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #4396      +/-   ##
============================================
+ Coverage     70.54%   70.61%   +0.06%     
- Complexity    56942    57126     +184     
============================================
  Files          4572     4584      +12     
  Lines        273816   274497     +681     
  Branches      40152    40226      +74     
============================================
+ Hits         193170   193833     +663     
+ Misses        64455    64431      -24     
- Partials      16191    16233      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dreamer-89 dreamer-89 changed the title [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica [Backport to 2.x] [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica Sep 3, 2022
@dreamer-89 dreamer-89 changed the title [Backport to 2.x] [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica [Backport 2.x] [Segment Replication] Add check to cancel ongoing replication with old primary on onNewCheckpoint on replica Sep 3, 2022
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2022

Gradle Check (Jenkins) Run Completed with:

@dreamer-89
Copy link
Copy Markdown
Member Author

dreamer-89 commented Sep 3, 2022

503 error during ping on github adoptium binary release. Will retry gradle check after some time.

> Task :distribution:bwc:maintenance:buildBwcLinuxTar
 [1.3.5] > Task :distribution:archives:buildLinux FAILED
 [1.3.5] build complete, generating: /var/jenkins/workspace/gradle-check/search/distribution/bwc/maintenance/build/bwc/checkout-1.3/build/2589.tar.bz2
 [1.3.5] 
 [1.3.5] 148 actionable tasks: 148 executed
 [1.3.5] FAILURE: Build failed with an exception.
 [1.3.5] 
 [1.3.5] * What went wrong:
 [1.3.5] Execution failed for task ':distribution:archives:buildLinux'.
 [1.3.5] > Could not resolve all files for configuration ':distribution:archives:jdk_bundled_linux_x64'.
 [1.3.5]    > Could not resolve adoptium_11:linux:11.0.16.
 [1.3.5]      Required by:
 [1.3.5]          project :distribution:archives
 [1.3.5]       > Could not resolve adoptium_11:linux:11.0.16.
 [1.3.5]          > Could not get resource 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16+8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz'.
 [1.3.5]             > Could not HEAD 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16+8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz'. Received status code 503 from server: Backend fetch failed
 [1.3.5] 
 [1.3.5] * Try:
 [1.3.5] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
 [1.3.5] 
 [1.3.5] * Get more help at https://help.gradle.org/
 [1.3.5] 
 [1.3.5] BUILD FAILED in 4m 18s

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2022

Gradle Check (Jenkins) Run Completed with:

@dreamer-89
Copy link
Copy Markdown
Member Author

This test was added as part of PR #4363. Looking into it.

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication" -Dtests.seed=6B983CC6B30CF463 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=nb-NO -Dtests.timezone=Africa/Malabo -Druntime.java=17

org.opensearch.indices.replication.SegmentReplicationTargetServiceTests > testOnNewCheckpointFromNewPrimaryCancelOngoingReplication FAILED
    org.mockito.exceptions.misusing.UnfinishedStubbingException: 
    Unfinished stubbing detected here:
    -> at org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

    E.g. thenReturn() may be missing.
    Examples of correct stubbing:
        when(mock.isOk()).thenReturn(true);
        when(mock.isOk()).thenThrow(exception);
        doThrow(exception).when(mock).someVoidMethod();
    Hints:
     1. missing thenReturn()
     2. you are trying to stub a final method, which is not supported
     3. you are stubbing the behaviour of another mock inside before 'thenReturn' instruction is completed
        at __randomizedtesting.SeedInfo.seed([6B983CC6B30CF463:B2A5F5E8335F5752]:0)
        at app//org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2022

Gradle Check (Jenkins) Run Completed with:

@mch2
Copy link
Copy Markdown
Member

mch2 commented Sep 5, 2022

This test was added as part of PR #4363. Looking into it.

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication" -Dtests.seed=6B983CC6B30CF463 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=nb-NO -Dtests.timezone=Africa/Malabo -Druntime.java=17

org.opensearch.indices.replication.SegmentReplicationTargetServiceTests > testOnNewCheckpointFromNewPrimaryCancelOngoingReplication FAILED
    org.mockito.exceptions.misusing.UnfinishedStubbingException: 
    Unfinished stubbing detected here:
    -> at org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

    E.g. thenReturn() may be missing.
    Examples of correct stubbing:
        when(mock.isOk()).thenReturn(true);
        when(mock.isOk()).thenThrow(exception);
        doThrow(exception).when(mock).someVoidMethod();
    Hints:
     1. missing thenReturn()
     2. you are trying to stub a final method, which is not supported
     3. you are stubbing the behaviour of another mock inside before 'thenReturn' instruction is completed
        at __randomizedtesting.SeedInfo.seed([6B983CC6B30CF463:B2A5F5E8335F5752]:0)
        at app//org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

For another seed - #4366 (comment)

@dreamer-89 dreamer-89 merged commit fc97324 into opensearch-project:2.x Sep 5, 2022
@dreamer-89
Copy link
Copy Markdown
Member Author

This test was added as part of PR #4363. Looking into it.

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication" -Dtests.seed=6B983CC6B30CF463 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=nb-NO -Dtests.timezone=Africa/Malabo -Druntime.java=17

org.opensearch.indices.replication.SegmentReplicationTargetServiceTests > testOnNewCheckpointFromNewPrimaryCancelOngoingReplication FAILED
    org.mockito.exceptions.misusing.UnfinishedStubbingException: 
    Unfinished stubbing detected here:
    -> at org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

    E.g. thenReturn() may be missing.
    Examples of correct stubbing:
        when(mock.isOk()).thenReturn(true);
        when(mock.isOk()).thenThrow(exception);
        doThrow(exception).when(mock).someVoidMethod();
    Hints:
     1. missing thenReturn()
     2. you are trying to stub a final method, which is not supported
     3. you are stubbing the behaviour of another mock inside before 'thenReturn' instruction is completed
        at __randomizedtesting.SeedInfo.seed([6B983CC6B30CF463:B2A5F5E8335F5752]:0)
        at app//org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testOnNewCheckpointFromNewPrimaryCancelOngoingReplication(SegmentReplicationTargetServiceTests.java:232)

For another seed - #4366 (comment)

Raised #4414

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants