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

[Segment Replication] Fixing flaky test failure happening for testShardAlreadyReplicating() #3943

Merged
merged 5 commits into from
Jul 20, 2022

Conversation

Rishikesh1159
Copy link
Member

Signed-off-by: Rishikesh1159 rishireddy1159@gmail.com

Description

This PR fixes flaky test failure of testShardAlreadyReplicating()

Issues Resolved

#3872

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: Rishikesh1159 <rishireddy1159@gmail.com>
@Rishikesh1159 Rishikesh1159 requested review from a team and reta as code owners July 19, 2022 06:10
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2022

Codecov Report

Merging #3943 (076f0ab) into main (07775ff) will decrease coverage by 0.00%.
The diff coverage is 64.37%.

@@             Coverage Diff              @@
##               main    #3943      +/-   ##
============================================
- Coverage     70.57%   70.57%   -0.01%     
- Complexity    56679    56748      +69     
============================================
  Files          4563     4573      +10     
  Lines        272755   273255     +500     
  Branches      40040    40076      +36     
============================================
+ Hits         192505   192839     +334     
- Misses        64014    64178     +164     
- Partials      16236    16238       +2     
Impacted Files Coverage Δ
...ark/time/NanoTimeVsCurrentTimeMillisBenchmark.java 0.00% <ø> (ø)
...a/org/opensearch/painless/antlr/PainlessLexer.java 68.18% <ø> (ø)
.../org/opensearch/painless/antlr/PainlessParser.java 68.43% <ø> (ø)
...earch/action/search/PitSearchContextIdForNode.java 0.00% <0.00%> (ø)
...ensearch/action/search/SearchContextIdForNode.java 94.44% <ø> (ø)
...er/src/main/java/org/opensearch/client/Client.java 40.00% <ø> (ø)
.../org/opensearch/client/support/AbstractClient.java 35.21% <0.00%> (+0.07%) ⬆️
...rg/opensearch/common/settings/ClusterSettings.java 91.89% <ø> (ø)
...pensearch/common/settings/IndexScopedSettings.java 100.00% <ø> (ø)
...rg/opensearch/action/search/CreatePitResponse.java 14.14% <14.14%> (ø)
... and 520 more

…rviceTests

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Member

@mch2 mch2 left a comment

Choose a reason for hiding this comment

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

LGTM

public void testShardAlreadyReplicating() {
SegmentReplicationTargetService spy = spy(sut);
public void testShardAlreadyReplicating() throws InterruptedException {
SegmentReplicationTargetService serviceSpy = spy(sut);
Copy link
Member

Choose a reason for hiding this comment

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

nit - A comment here explaining why we need to spy on the service and what we are asserting would be useful.

Copy link
Member

@kartg kartg left a comment

Choose a reason for hiding this comment

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

Approving since the test is functioning properly, but please consider adding more comments to the testShardAlreadyReplicating test case to make it easier to understand. The test is manipulating a lot of objects to achieve a specific scenario and it's hard to quickly grok what each step is doing.

Comment on lines 63 to 64
cp = indexShard.getLatestReplicationCheckpoint();
newCheckpoint = new ReplicationCheckpoint(
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick - more descriptive variable names, please. cp is hard to decipher at first glance and newCheckpoint is confusing when it's being initialized to be equal to cp

public void testShardAlreadyReplicating() {
SegmentReplicationTargetService spy = spy(sut);
public void testShardAlreadyReplicating() throws InterruptedException {
SegmentReplicationTargetService serviceSpy = spy(sut);
// Create a separate target and start it so the shard is already replicating.
Copy link
Member

Choose a reason for hiding this comment

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

This comment seems out of place now since the replication is not started until multiple lines later. Consider removing it

…cating() test case

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
…to main

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@Rishikesh1159 Rishikesh1159 merged commit 4466a1f into opensearch-project:main Jul 20, 2022
Rishikesh1159 added a commit to Rishikesh1159/OpenSearch that referenced this pull request Aug 10, 2022
…rdAlreadyReplicating() (opensearch-project#3943)

* Fixing flaky test failure happening for testShardAlreadyReplicating()

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
Rishikesh1159 added a commit to Rishikesh1159/OpenSearch that referenced this pull request Aug 10, 2022
Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
Rishikesh1159 added a commit that referenced this pull request Aug 11, 2022
…#3943 #3963 From main branch (#4181)

* Resolving import conflict in Node.java and mergining PR #3525.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Resolving conflicts and merging PR #3533.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Resolving conflicts and Merging PR #3540.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Applying spotlesscheck and fixing wildcard imports.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* [Segment Replication] Fixing flaky test failure happening for testShardAlreadyReplicating() (#3943)

* Fixing flaky test failure happening for testShardAlreadyReplicating()

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Fix possible flaky test for testBeforeIndexShardClosed_CancelsOngoingReplications() (#3963)

* Fixing flaky test failure happening for testShardAlreadyReplicating()

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Removing assert segrep() in getProcessedLocalCheckpoint() of Index.shard class.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Adding back assert statement and make index setting to segment replication in SegmentReplicationSourceHandlerTests and SegmentReplicationTargetServiceTests.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>

* Revert "Adding back assert statement and make index setting to segment replication in SegmentReplicationSourceHandlerTests and SegmentReplicationTargetServiceTests."
Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
This reverts commit 8c5753b.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
Co-authored-by: Marc Handalian <handalm@amazon.com>
Co-authored-by: Poojita Raj <poojiraj@amazon.com>
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.

4 participants