From f33f71af1223768cf62e6f8f7fe46830c66de42e Mon Sep 17 00:00:00 2001 From: pgomulka Date: Wed, 26 Aug 2020 12:48:23 +0200 Subject: [PATCH 1/2] deprecation bwc test --- .../test/mixed_cluster/20_joda.yml | 15 +++++++ .../test/old_cluster/20_joda.yml | 42 +++++++++++++++++++ .../test/upgraded_cluster/20_joda.yml | 14 +++++++ .../common/util/concurrent/ThreadContext.java | 1 + 4 files changed, 72 insertions(+) create mode 100644 qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml create mode 100644 qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml create mode 100644 qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/20_joda.yml diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml new file mode 100644 index 0000000000000..c71d4edac8640 --- /dev/null +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml @@ -0,0 +1,15 @@ +--- +"Search index with joda format that generates a warning": + - skip: + features: "node_selector" + - do: + node_selector: + version: " - 6.6.99" + search: + index: jodaindex* + body: + query: + range: + datefield: + gte: "2019-01-01T00:00+01:00" + - match: { hits.total: 5 } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml new file mode 100644 index 0000000000000..cd8f989d67e4a --- /dev/null +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml @@ -0,0 +1,42 @@ +--- +"Create index with joda format that generates a warning": + - skip: + features: "warnings" + version: "6.7.1 - " + reason: date from warning wars removed in 6.7 + - do: + indices.create: + index: jodaindex + body: + settings: + index: + number_of_replicas: 0 + mappings: + "doc": + "properties": + "datefield": + "type": "date" + "format": "YYYY-MM-dd'T'HH:mmZZ" + + - do: + bulk: + refresh: true + body: + - '{"index": {"_index": "jodaindex1", "_type": "doc"}}' + - '{"datefield": "2019-01-02T00:00+01:00"}' + - '{"index": {"_index": "jodaindex2", "_type": "doc"}}' + - '{"datefield": "2019-01-02T00:00+01:00"}' + - '{"index": {"_index": "jodaindex3", "_type": "doc"}}' + - '{"datefield": "2019-01-02T00:00+01:00"}' + - '{"index": {"_index": "jodaindex4", "_type": "doc"}}' + - '{"datefield": "2019-01-02T00:00+01:00"}' + + - do: + search: + index: jodaindex* + body: + query: + range: + datefield: + gte: "2019-01-01T00:00+01:00" + - match: { hits.total: 4 } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/20_joda.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/20_joda.yml new file mode 100644 index 0000000000000..22f0ae29b7926 --- /dev/null +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/20_joda.yml @@ -0,0 +1,14 @@ +--- +"Search index with joda format that generates a warning": + - skip: + features: "warnings" + - do: + search: + rest_total_hits_as_int: true + index: jodaindex* + body: + query: + range: + datefield: + gte: "2019-01-01T00:00+01:00" + - match: { hits.total: 5 } diff --git a/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java b/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java index 0fa0e832a0a2b..ac8772d3840ec 100644 --- a/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java +++ b/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java @@ -489,6 +489,7 @@ private void putSingleHeader(String key, String value, Map newHe } } + private ThreadContextStruct putHeaders(Map headers) { if (headers.isEmpty()) { return this; From e2a1a264b4de59caf3bcf9388faaace773d37ed1 Mon Sep 17 00:00:00 2001 From: pgomulka Date: Wed, 26 Aug 2020 15:25:00 +0200 Subject: [PATCH 2/2] reproduced --- qa/rolling-upgrade/build.gradle | 1 + .../test/mixed_cluster/20_joda.yml | 53 ++++++++++++++++--- .../test/old_cluster/20_joda.yml | 15 ++---- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index e14220bc5bb83..5941ab03b95d4 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -86,6 +86,7 @@ for (Version version : bwcVersions.wireCompatible) { dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir } setting 'repositories.url.allowed_urls', 'http://snapshot.test*' setting 'node.name', "upgraded-node-${stopNode}" + setting 'node.attr.gen', "upgraded" setting 'logger.level', 'DEBUG' } } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml index c71d4edac8640..ba4c93b089bdc 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml @@ -1,15 +1,54 @@ +--- +"Index to old node": + - skip: + features: ["node_selector","warnings"] + - do: + node_selector: + attribute: + gen: "old" + bulk: + refresh: true + body: + - '{"index": {"_index": "jodaindex", "_type": "doc", "_id": "id_2"}}' + - '{"datefield": "2019-01-02T00:00+01:00"}' + + - do: + indices.flush: + index: jodaindex + + - do: + node_selector: + attribute: + gen: "old" + warnings: + - 'There are doc-value fields which are not using a format. The output will change in 7.0 when doc value fields get formatted based on mappings by default. It is recommended to pass [format=use_field_mapping] with a doc value field in order to opt in for the future behaviour and ease the migration to 7.0: [count]' + search: + index: jodaindex + body: + sort: datefield + docvalue_fields: [ "count"] + - match: { hits.total: 2 } + - match: { hits.hits.0._id: id_1 } + - match: { hits.hits.1._id: id_2 } + - match: { _shards.failed: 0 } + + + --- "Search index with joda format that generates a warning": - skip: features: "node_selector" - do: node_selector: - version: " - 6.6.99" + attribute: + gen: "upgraded" search: - index: jodaindex* + index: jodaindex body: - query: - range: - datefield: - gte: "2019-01-01T00:00+01:00" - - match: { hits.total: 5 } + sort: datefield + docvalue_fields: [ "count"] + - match: { hits.total: 2 } + - match: { hits.hits.0._id: id_1 } + - match: { hits.hits.1._id: id_2 } + - match: { _shards.failed: 0 } + diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml index cd8f989d67e4a..18ec38a819ce1 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml @@ -8,9 +8,6 @@ indices.create: index: jodaindex body: - settings: - index: - number_of_replicas: 0 mappings: "doc": "properties": @@ -22,21 +19,15 @@ bulk: refresh: true body: - - '{"index": {"_index": "jodaindex1", "_type": "doc"}}' - - '{"datefield": "2019-01-02T00:00+01:00"}' - - '{"index": {"_index": "jodaindex2", "_type": "doc"}}' - - '{"datefield": "2019-01-02T00:00+01:00"}' - - '{"index": {"_index": "jodaindex3", "_type": "doc"}}' - - '{"datefield": "2019-01-02T00:00+01:00"}' - - '{"index": {"_index": "jodaindex4", "_type": "doc"}}' + - '{"index": {"_index": "jodaindex", "_type": "doc", "_id": "id_1"}}' - '{"datefield": "2019-01-02T00:00+01:00"}' - do: search: - index: jodaindex* + index: jodaindex body: query: range: datefield: gte: "2019-01-01T00:00+01:00" - - match: { hits.total: 4 } + - match: { hits.total: 1 }