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

Prevent starting replication directly on the leader index alias. #66

Merged
merged 1 commit into from
Jul 28, 2021
Merged

Conversation

krishna-ggk
Copy link
Collaborator

Prevent starting replication directly on the leader index alias.

(This was previously resulting in NPE)

The rationale is to avoid complexity for now since an alias can be
associated with multiple indices, although an extension could be to
allow replication if there is a single match.

Added an integration test to validate the case.

While at it, also expanded BasicReplicationIT to incorporate force merge
and ensure that doesn't impact replication.

Check List

  • 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.

Comment on lines +267 to +283
try {
followerClient.startReplication(StartReplicationRequest("source", "leaderAlias", followerIndexName))
fail("Expected startReplication to fail")
} catch (e: ResponseException) {
assertThat(e.response.statusLine.statusCode).isEqualTo(404)
assertThat(e.message).contains("index_not_found_exception")
assertThat(e.message).contains("no such index [leaderAlias]")
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't use assertThatThrownBy since it didn't provide flexibility to extract statusCode.

(This was previously resulting in NPE)

The rationale is to avoid complexity for now since an alias can be
associated with multiple indices, although an extension could be to
allow replication if there is a single match.

Added an integration test to validate the case.

While at it, also expanded BasicReplicationIT to incorporate force merge
and ensure that doesn't impact replication.

Signed-off-by: Gopala Krishna Ambareesh <[email protected]>
val waitMillis = Duration.ofMinutes(1).toMillis()
val waitMillis = Duration.ofMinutes(10).toMillis()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also sneaking in this change - we felt 1 min might be too low.

@krishna-ggk krishna-ggk merged commit f44abda into opensearch-project:main Jul 28, 2021
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