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 new file mode 100644 index 0000000000000..ba4c93b089bdc --- /dev/null +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/20_joda.yml @@ -0,0 +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: + attribute: + gen: "upgraded" + 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 } + 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..18ec38a819ce1 --- /dev/null +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/20_joda.yml @@ -0,0 +1,33 @@ +--- +"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: + mappings: + "doc": + "properties": + "datefield": + "type": "date" + "format": "YYYY-MM-dd'T'HH:mmZZ" + + - do: + bulk: + refresh: true + body: + - '{"index": {"_index": "jodaindex", "_type": "doc", "_id": "id_1"}}' + - '{"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: 1 } 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;