Skip to content

Commit 828b61c

Browse files
committed
Merge branch 'master' into global-checkpoint-polling
* master: (24 commits) Only notify ready global checkpoint listeners (elastic#33690) Don't count hits via the collector if the hit count can be computed from index stats. (elastic#33701) Expose retries for CCR fetch failures (elastic#33694) Test fix - Graph vertices could appear in different orders based on map insertion sequence (elastic#33709) Structured audit logging (elastic#31931) Core: Add DateFormatter interface for java time parsing (elastic#33467) [CCR] Check whether the rejected execution exception has the shutdown flag set (elastic#33703) Mute ClusterDisruptionIT#testSendingShardFailure Revert "Mute FullClusterRestartSettingsUpgradeIT" Adjust BWC version on settings upgrade test (elastic#33650) [ML] Allow overrides for some file structure detection decisions (elastic#33630) Adapt skip version for doc_values format deprecation [TEST] wait for no initializing shards [Docs] Minor fix in `has_child` javadoc comment (elastic#33674) Mute FullClusterRestartSettingsUpgradeIT [Kerberos] Add realm name & UPN to user metadata (elastic#33338) [TESTS] Disable specific locales for RestrictedTrustManagerTest (elastic#33299) SQL: Return functions in JDBC driver metadata (elastic#33672) SCRIPTING: Move terms_set Context to its Own Class (elastic#33602) AwaitsFix testRestoreMinmal ...
2 parents 426b359 + 3919133 commit 828b61c

File tree

120 files changed

+4516
-2039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4516
-2039
lines changed

docs/reference/migration/migrate_7_0/api.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ depending on whether {security} is enabled. Previously a
8787
404 - NOT FOUND (IndexNotFoundException) could be returned in case the
8888
current user was not authorized for any alias. An empty response with
8989
status 200 - OK is now returned instead at all times.
90+
91+
==== Put User API response no longer has `user` object
92+
93+
The Put User API response was changed in 6.5.0 to add the `created` field
94+
outside of the user object where it previously had been. In 7.0.0 the user
95+
object has been removed in favor of the top level `created` field.

docs/reference/sql/endpoints/client-apps/index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[[sql-client-apps]]
44
== SQL Client Applications
55

6-
Thanks to its <<sql-jdbc, JDBC>> interface, {es-sql} supports a broad range of applications.
6+
Thanks to its <<sql-jdbc, JDBC>> interface, a broad range of third-party applications can use {es}'s SQL capabilities.
77
This section lists, in alphabetical order, a number of them and their respective configuration - the list however is by no means comprehensive (feel free to https://www.elastic.co/blog/art-of-pull-request[submit a PR] to improve it):
88
as long as the app can use the {es-sql} driver, it can use {es-sql}.
99

modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ public ScoreMode scoreMode() {
183183

184184
/**
185185
* Returns the minimum number of children that are required to match for the parent to be considered a match.
186-
* The default is {@value #DEFAULT_MAX_CHILDREN}
186+
* The default is {@value #DEFAULT_MIN_CHILDREN}
187187
*/
188188
public int minChildren() {
189189
return minChildren;
190190
}
191191

192192
/**
193193
* Returns the maximum number of children that are required to match for the parent to be considered a match.
194-
* The default is {@value #DEFAULT_MIN_CHILDREN}
194+
* The default is {@value #DEFAULT_MAX_CHILDREN}
195195
*/
196196
public int maxChildren() { return maxChildren; }
197197

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
public class FullClusterRestartSettingsUpgradeIT extends AbstractFullClusterRestartTestCase {
4343

4444
public void testRemoteClusterSettingsUpgraded() throws IOException {
45+
assumeTrue("skip_unavailable did not exist until 6.1.0", getOldClusterVersion().onOrAfter(Version.V_6_1_0));
4546
assumeTrue("settings automatically upgraded since 6.5.0", getOldClusterVersion().before(Version.V_6_5_0));
4647
if (isRunningAgainstOldCluster()) {
4748
final Request putSettingsRequest = new Request("PUT", "/_cluster/settings");

rest-api-spec/src/main/resources/rest-api-spec/test/search/10_source_filtering.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ setup:
134134
---
135135
"docvalue_fields":
136136
- skip:
137-
version: " - 6.3.99"
138-
reason: format option was added in 6.4
137+
version: " - 6.4.0"
138+
reason: format option was added in 6.4 and the deprecation message changed in 6.4.1
139139
features: warnings
140140
- do:
141141
warnings:
@@ -148,8 +148,8 @@ setup:
148148
---
149149
"multiple docvalue_fields":
150150
- skip:
151-
version: " - 6.3.99"
152-
reason: format option was added in 6.4
151+
version: " - 6.4.0"
152+
reason: format option was added in 6.4 and the deprecation message changed in 6.4.1
153153
features: warnings
154154
- do:
155155
warnings:
@@ -162,8 +162,8 @@ setup:
162162
---
163163
"docvalue_fields as url param":
164164
- skip:
165-
version: " - 6.3.99"
166-
reason: format option was added in 6.4
165+
version: " - 6.4.0"
166+
reason: format option was added in 6.4 and the deprecation message changed in 6.4.1
167167
features: warnings
168168
- do:
169169
warnings:

server/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.elasticsearch.common.io.stream.Writeable;
2929
import org.elasticsearch.common.settings.Setting;
3030
import org.elasticsearch.common.settings.Settings;
31-
import org.elasticsearch.common.time.CompoundDateTimeFormatter;
31+
import org.elasticsearch.common.time.DateFormatter;
3232
import org.elasticsearch.common.time.DateFormatters;
3333
import org.elasticsearch.common.xcontent.ContextParser;
3434
import org.elasticsearch.common.xcontent.ObjectParser;
@@ -368,8 +368,7 @@ public static final class Tombstone implements ToXContentObject, Writeable {
368368
TOMBSTONE_PARSER.declareString((b, s) -> {}, new ParseField(DELETE_DATE_KEY));
369369
}
370370

371-
static final CompoundDateTimeFormatter FORMATTER =
372-
DateFormatters.forPattern("strict_date_optional_time").withZone(ZoneOffset.UTC);
371+
static final DateFormatter FORMATTER = DateFormatters.forPattern("strict_date_optional_time").withZone(ZoneOffset.UTC);
373372

374373
static ContextParser<Void, Tombstone> getParser() {
375374
return (parser, context) -> TOMBSTONE_PARSER.apply(parser, null).build();

server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.elasticsearch.common.settings.Setting;
3232
import org.elasticsearch.common.settings.Setting.Property;
3333
import org.elasticsearch.common.settings.Settings;
34-
import org.elasticsearch.common.time.CompoundDateTimeFormatter;
34+
import org.elasticsearch.common.time.DateFormatter;
3535
import org.elasticsearch.common.time.DateFormatters;
3636
import org.elasticsearch.common.unit.TimeValue;
3737
import org.elasticsearch.common.xcontent.ToXContentFragment;
@@ -48,8 +48,7 @@
4848
*/
4949
public final class UnassignedInfo implements ToXContentFragment, Writeable {
5050

51-
public static final CompoundDateTimeFormatter DATE_TIME_FORMATTER =
52-
DateFormatters.forPattern("dateOptionalTime").withZone(ZoneOffset.UTC);
51+
public static final DateFormatter DATE_TIME_FORMATTER = DateFormatters.forPattern("dateOptionalTime").withZone(ZoneOffset.UTC);
5352

5453
public static final Setting<TimeValue> INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING =
5554
Setting.positiveTimeSetting("index.unassigned.node_left.delayed_timeout", TimeValue.timeValueMinutes(1), Property.Dynamic,

server/src/main/java/org/elasticsearch/common/Table.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
package org.elasticsearch.common;
2121

22-
import org.elasticsearch.common.time.CompoundDateTimeFormatter;
22+
import org.elasticsearch.common.time.DateFormatter;
2323
import org.elasticsearch.common.time.DateFormatters;
2424

2525
import java.time.Instant;
@@ -85,7 +85,7 @@ public Table endHeaders() {
8585
return this;
8686
}
8787

88-
private static final CompoundDateTimeFormatter FORMATTER = DateFormatters.forPattern("HH:mm:ss").withZone(ZoneOffset.UTC);
88+
private static final DateFormatter FORMATTER = DateFormatters.forPattern("HH:mm:ss").withZone(ZoneOffset.UTC);
8989

9090
public Table startRow() {
9191
if (headers.isEmpty()) {
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.common.time;
21+
22+
import java.time.ZoneId;
23+
import java.time.format.DateTimeParseException;
24+
import java.time.temporal.TemporalAccessor;
25+
import java.time.temporal.TemporalField;
26+
import java.util.Arrays;
27+
import java.util.Map;
28+
import java.util.stream.Collectors;
29+
30+
public interface DateFormatter {
31+
32+
/**
33+
* Try to parse input to a java time TemporalAccessor
34+
* @param input An arbitrary string resembling the string representation of a date or time
35+
* @throws DateTimeParseException If parsing fails, this exception will be thrown.
36+
* Note that it can contained suppressed exceptions when several formatters failed parse this value
37+
* @return The java time object containing the parsed input
38+
*/
39+
TemporalAccessor parse(String input);
40+
41+
/**
42+
* Create a copy of this formatter that is configured to parse dates in the specified time zone
43+
*
44+
* @param zoneId The time zone to act on
45+
* @return A copy of the date formatter this has been called on
46+
*/
47+
DateFormatter withZone(ZoneId zoneId);
48+
49+
/**
50+
* Print the supplied java time accessor in a string based representation according to this formatter
51+
*
52+
* @param accessor The temporal accessor used to format
53+
* @return The string result for the formatting
54+
*/
55+
String format(TemporalAccessor accessor);
56+
57+
/**
58+
* A name based format for this formatter. Can be one of the registered formatters like <code>epoch_millis</code> or
59+
* a configured format like <code>HH:mm:ss</code>
60+
*
61+
* @return The name of this formatter
62+
*/
63+
String pattern();
64+
65+
/**
66+
* Configure a formatter using default fields for a TemporalAccessor that should be used in case
67+
* the supplied date is not having all of those fields
68+
*
69+
* @param fields A <code>Map&lt;TemporalField, Long&gt;</code> of fields to be used as fallbacks
70+
* @return A new date formatter instance, that will use those fields during parsing
71+
*/
72+
DateFormatter parseDefaulting(Map<TemporalField, Long> fields);
73+
74+
/**
75+
* Merge several date formatters into a single one. Useful if you need to have several formatters with
76+
* different formats act as one, for example when you specify a
77+
* format like <code>date_hour||epoch_millis</code>
78+
*
79+
* @param formatters The list of date formatters to be merged together
80+
* @return The new date formtter containing the specified date formatters
81+
*/
82+
static DateFormatter merge(DateFormatter ... formatters) {
83+
return new MergedDateFormatter(formatters);
84+
}
85+
86+
class MergedDateFormatter implements DateFormatter {
87+
88+
private final String format;
89+
private final DateFormatter[] formatters;
90+
91+
MergedDateFormatter(DateFormatter ... formatters) {
92+
this.formatters = formatters;
93+
this.format = Arrays.stream(formatters).map(DateFormatter::pattern).collect(Collectors.joining("||"));
94+
}
95+
96+
@Override
97+
public TemporalAccessor parse(String input) {
98+
DateTimeParseException failure = null;
99+
for (DateFormatter formatter : formatters) {
100+
try {
101+
return formatter.parse(input);
102+
} catch (DateTimeParseException e) {
103+
if (failure == null) {
104+
failure = e;
105+
} else {
106+
failure.addSuppressed(e);
107+
}
108+
}
109+
}
110+
throw failure;
111+
}
112+
113+
@Override
114+
public DateFormatter withZone(ZoneId zoneId) {
115+
return new MergedDateFormatter(Arrays.stream(formatters).map(f -> f.withZone(zoneId)).toArray(DateFormatter[]::new));
116+
}
117+
118+
@Override
119+
public String format(TemporalAccessor accessor) {
120+
return formatters[0].format(accessor);
121+
}
122+
123+
@Override
124+
public String pattern() {
125+
return format;
126+
}
127+
128+
@Override
129+
public DateFormatter parseDefaulting(Map<TemporalField, Long> fields) {
130+
return new MergedDateFormatter(Arrays.stream(formatters).map(f -> f.parseDefaulting(fields)).toArray(DateFormatter[]::new));
131+
}
132+
}
133+
}

0 commit comments

Comments
 (0)