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

Move segment replication setting to IndexMetadata so that it can be set during index creation. #2284

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

mch2
Copy link
Member

@mch2 mch2 commented Feb 28, 2022

Description

Move segment replication setting to IndexMetadata so that it can be set during index creation. This change also adds a simple integration test - SegmentReplicationIT that indexes some docs then compares doc counts between primary and replica shards.

This integ test is failing 20% of the time and produces reproducible seeds. Example seed:

./gradlew ':server:internalClusterTest' --tests "org.opensearch.indices.replication.SegmentReplicationIT.testReplicationAfterPrimaryRefreshAndFlush" -Dtests.seed=5F30ED7187D1E2E4 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=ro-RO -Dtests.timezone=Libya -Druntime.java=17 -Dtests.output=true -Dtests.opensearch.logger.level=DEBUG

This failure is when comparing the doc count on line 58 of the test after performing a flush. I'm not sure whats going on here yet , reader.numDocs() is returning the correct number after performing a refresh in OpenSearchReaderManager.

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.

@mch2 mch2 requested a review from a team as a code owner February 28, 2022 19:32
@opensearch-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@mch2
Copy link
Member Author

mch2 commented Feb 28, 2022

I've cut an issue to fix the errors - #2285. I think this PR alone still holds value to run the tests against the general case as we iterate on segrep.

waitForDocs(additionalDocCount, indexer);
}
flush(INDEX_NAME);
Thread.sleep(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this sleep to wait for flush operation to complete? And do we need to explicitly call flush?

Copy link
Member Author

@mch2 mch2 Feb 28, 2022

Choose a reason for hiding this comment

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

The sleep is to wait for the segment files to be copied over before we check the doc counts, without this we have a low risk that that process may not be complete. Yes, we call flush here so that we guarantee the primary is on a new commit point so we can test the replica can read it.


import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount;

@ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is numDataNodes set to 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

This sets the number of nodes to start the test with. If unset a random number is used.

…et during index creation.

This change also adds an integration test - SegmentReplicationIT.

Signed-off-by: Marc Handalian <[email protected]>
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure f4ca44f3ba7addefc6bf41b7f91d9551c331f0c1
Log 2874

Reports 2874

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 438265f7050b8abe10d637a775c0aac47af5f9c0
Log 2875

Reports 2875

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure eb2579c
Log 2878

Reports 2878

@@ -891,6 +882,10 @@ public int getNumberOfReplicas() {
return settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, null);
}

public boolean isSegrepEnabled() {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick - I'd prefer the method name to be explicit i.e. isSegmentReplicationEnabled

@mch2 mch2 merged commit 4d25000 into opensearch-project:feature/segment-replication Mar 3, 2022
Poojita-Raj pushed a commit to Poojita-Raj/OpenSearch that referenced this pull request Apr 14, 2022
Poojita-Raj pushed a commit to Poojita-Raj/OpenSearch that referenced this pull request Apr 14, 2022
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