From 3dd8db876b88d73967d4fa94e0220a348c178723 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 29 May 2017 15:59:17 +0200 Subject: [PATCH 1/2] Add a dummy_index to upgrade tests to ensure we recover fine with replicas We default to 0 replicas in the rolling restart scenario already to ensure we test against worst case. Yet, this adds a dummy index to ensure we also recover and index with relicas just fine. --- .../test/mixed_cluster/10_basic.yml | 6 +++ .../test/old_cluster/10_basic.yml | 37 ++++++++++++++++--- .../test/upgraded_cluster/10_basic.yml | 6 +++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml index 4def6fa5da589..73942a6baf8ca 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml @@ -11,6 +11,12 @@ - match: { hits.total: 5 } # no new indexed data, so expect the original 5 documents from the old cluster + - do: + search: + index: dummy_index + + - match: { hits.total: 5 } # just check we recovered fine + - do: bulk: refresh: true diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml index a5e9a26a9a164..062fc012ae5da 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml @@ -8,24 +8,43 @@ index: number_of_replicas: 0 + - do: + indices.create: + index: dummy_index # dummy index to ensure we can recover indices with replicas just fine + - do: bulk: refresh: true body: - - '{"index": {"_index": "test_index", "_type": "test_type"}}' + - '{"index": {"_index": "test_index", "_type": "doc"}}' - '{"f1": "v1_old", "f2": 0}' - - '{"index": {"_index": "test_index", "_type": "test_type"}}' + - '{"index": {"_index": "test_index", "_type": "doc"}}' - '{"f1": "v2_old", "f2": 1}' - - '{"index": {"_index": "test_index", "_type": "test_type"}}' + - '{"index": {"_index": "test_index", "_type": "doc"}}' - '{"f1": "v3_old", "f2": 2}' - - '{"index": {"_index": "test_index", "_type": "test_type"}}' + - '{"index": {"_index": "test_index", "_type": "doc"}}' - '{"f1": "v4_old", "f2": 3}' - - '{"index": {"_index": "test_index", "_type": "test_type"}}' + - '{"index": {"_index": "test_index", "_type": "doc"}}' - '{"f1": "v5_old", "f2": 4}' + - do: + bulk: + refresh: true + body: + - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"f1": "d_old"}' + - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"f1": "d_old"}' + - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"f1": "d_old"}' + - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"f1": "d_old"}' + - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"f1": "d_old"}' + - do: indices.flush: - index: test_index + index: test_index,dummy_index - do: search: @@ -33,6 +52,12 @@ - match: { hits.total: 5 } + - do: + search: + index: dummy_index + + - match: { hits.total: 5 } + - do: snapshot.create_repository: repository: my_repo diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml index 93c85582c9083..f6114e8eb2777 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml @@ -11,6 +11,12 @@ - match: { hits.total: 10 } # no new indexed data, so expect the original 10 documents from the old and mixed clusters + - do: + search: + index: dummy_index + + - match: { hits.total: 5 } # just check we recovered fine + - do: bulk: refresh: true From b57960efa433b9e1e311cc1f259b9d7c74a2396d Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 29 May 2017 17:09:28 +0200 Subject: [PATCH 2/2] rename index --- .../test/mixed_cluster/10_basic.yml | 2 +- .../rest-api-spec/test/old_cluster/10_basic.yml | 16 ++++++++-------- .../test/upgraded_cluster/10_basic.yml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml index 73942a6baf8ca..14282e6a00fc3 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yml @@ -13,7 +13,7 @@ - do: search: - index: dummy_index + index: index_with_replicas - match: { hits.total: 5 } # just check we recovered fine diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml index 062fc012ae5da..14c25aa101dde 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/10_basic.yml @@ -10,7 +10,7 @@ - do: indices.create: - index: dummy_index # dummy index to ensure we can recover indices with replicas just fine + index: index_with_replicas # dummy index to ensure we can recover indices with replicas just fine - do: bulk: @@ -31,20 +31,20 @@ bulk: refresh: true body: - - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"index": {"_index": "index_with_replicas", "_type": "doc"}}' - '{"f1": "d_old"}' - - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"index": {"_index": "index_with_replicas", "_type": "doc"}}' - '{"f1": "d_old"}' - - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"index": {"_index": "index_with_replicas", "_type": "doc"}}' - '{"f1": "d_old"}' - - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"index": {"_index": "index_with_replicas", "_type": "doc"}}' - '{"f1": "d_old"}' - - '{"index": {"_index": "dummy_index", "_type": "doc"}}' + - '{"index": {"_index": "index_with_replicas", "_type": "doc"}}' - '{"f1": "d_old"}' - do: indices.flush: - index: test_index,dummy_index + index: test_index,index_with_replicas - do: search: @@ -54,7 +54,7 @@ - do: search: - index: dummy_index + index: index_with_replicas - match: { hits.total: 5 } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml index f6114e8eb2777..725883e7ed57b 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yml @@ -13,7 +13,7 @@ - do: search: - index: dummy_index + index: index_with_replicas - match: { hits.total: 5 } # just check we recovered fine