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

Added CCR rolling upgrade tests #36648

Merged
merged 18 commits into from
Jan 8, 2019

Conversation

martijnvg
Copy link
Member

Tests index following and auto following in a rolling upgrade scenario.

Test are written as Java tests using low level client instead of yaml tests, because CCR needs assertBusy(...) snippets to be tested correctly and that is not possible in yaml tests.

@martijnvg martijnvg added >test Issues or PRs that are addressing/adding tests WIP v7.0.0 :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features v6.6.0 labels Dec 14, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@martijnvg
Copy link
Member Author

This test is currently marked as WIP as it depends on a bug fix: #36647 and
sometime it fails with serialization errors that occur when a 6.6.0-SNAPSHOT node receives a shard changes reponse from a 7.0.0-SNAPSHOT node:

Caused by: java.lang.IllegalArgumentException: No version type match [-1]
        at org.elasticsearch.index.VersionType.fromValue(VersionType.java:368) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Index.<init>(Translog.java:1151) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Index.<init>(Translog.java:1120) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Operation.readOperation(Translog.java:1072) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.common.io.stream.StreamInput.readArray(StreamInput.java:734) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.xpack.ccr.action.ShardChangesAction$Response.readFrom(ShardChangesAction.java:282) ~[?:?]

I'm not yet sure how this can happen, because the serialization logic in Translog.Index looks okay to me in both master and 6.x branches.

@martijnvg
Copy link
Member Author

I've also noticed this serialization error in bulk shards operations api:

[2018-12-14T19:52:59,864][WARN ][o.e.x.c.a.ShardFollowNodeTask] [upgraded-node-0] shard follow task encounter non-retryable error
org.elasticsearch.transport.RemoteTransportException: [node-2][127.0.0.1:34723][indices:data/write/bulk_shard_operations[s]]
Caused by: java.lang.IllegalArgumentException: No version type match [-1]
        at org.elasticsearch.index.VersionType.fromValue(VersionType.java:368) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Index.<init>(Translog.java:1151) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Index.<init>(Translog.java:1120) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.index.translog.Translog$Operation.readOperation(Translog.java:1072) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.common.io.stream.StreamInput.readCollection(StreamInput.java:959) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.common.io.stream.StreamInput.readList(StreamInput.java:941) ~[elasticsearch-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
        at org.elasticsearch.xpack.ccr.action.bulk.BulkShardOperationsRequest.readFrom(BulkShardOperationsRequest.java:54) ~[?:?]

@dnhatn
Copy link
Member

dnhatn commented Dec 19, 2018

@martijnvg I have merged #36676 which should fix the translog serialization issue.

@martijnvg martijnvg removed the WIP label Dec 20, 2018
@martijnvg
Copy link
Member Author

run the gradle build tests 1

@martijnvg
Copy link
Member Author

run the gradle build tests 2

@martijnvg
Copy link
Member Author

@dnhatn I've update this PR. Do you want to take another look?

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

Thanks @martijnvg. I like these tests - they are easy to follow. I left some minor comments.


private static void putAutoFollowPattern(String patternName) throws IOException {
Request request = new Request("PUT", "/_ccr/auto_follow/" + patternName);
request.setJsonEntity("{\"leader_index_patterns\": [\"logs-*\"], \"remote_cluster\": \"local\"," +
Copy link
Member

Choose a reason for hiding this comment

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

It's easier to follow if we pass the pattern (that's logs-*) as a parameter.

}

private void assertFollowerGlobalCheckpoint(String followerIndex, int expectedFollowerCheckpoint) throws IOException {
Request statsRequest = new Request("GET", "/" + followerIndex + "/_ccr/stats");
Copy link
Member

Choose a reason for hiding this comment

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

I think a seq_no stats of the following index would give us a stronger confidence than the ccr stats.

}
}

private void assertNumberOfSuccessfulFollowedIndices(int expectedNumberOfSuccessfulFollowedIndices) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove this method and assert the result of "getNumberOfSuccessfulFollowedIndices"?


pauseFollow("copy-" + leaderIndex2);
closeIndex("copy-" + leaderIndex2);
unfollow("copy-" + leaderIndex2);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe do all pause, close and unfollow in a single method?

case MIXED:
if (SECOND_ROUND == false) {
index(leaderIndex, "2");
assertDocumentExists(leaderIndex, "2");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe assert the existence of both doc1 and doc2? You can extend assertDocumentExists to accept varargs.

@martijnvg
Copy link
Member Author

@dnhatn I've updated the PR.

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @martijnvg. I left minor nits but feel free to merge once CI is happy.

assertDocumentExists(leaderIndex, "4");
assertBusy(() -> {
assertFollowerGlobalCheckpoint(followerIndex, 3);
assertDocumentExists(followerIndex, "4");
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we also verify doc1, doc2, and doc3?

assertDocumentExists(leaderIndex, "3");
assertBusy(() -> {
assertFollowerGlobalCheckpoint(followerIndex, 2);
assertDocumentExists(followerIndex, "3");
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we also verify doc1, and doc2

@martijnvg martijnvg merged commit c980cc1 into elastic:master Jan 8, 2019
@martijnvg
Copy link
Member Author

I will backport this later to 6.x, if I didn't encounter build failures related to this change.

martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Jan 11, 2019
Added CCR rolling upgrade tests.
martijnvg added a commit that referenced this pull request Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CCR Issues around the Cross Cluster State Replication features >test Issues or PRs that are addressing/adding tests v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants