Skip to content

Commit 79e3c07

Browse files
committed
Merge branch 'master' into async-errors
* master: Add a note to the docs that _cat api `help` option cannot be used if an optional url param is used (elastic#28686) Lift error finding utility to exceptions helpers Change "tweet" type to "_doc" (elastic#28690) [Docs] Add missing word in nested.asciidoc (elastic#28507) Simplify the Translog constructor by always expecting an existing translog (elastic#28676) Upgrade t-digest to 3.2 (elastic#28295) (elastic#28305) Add comment explaining lazy declared versions
2 parents 842f331 + 658ca5e commit 79e3c07

File tree

23 files changed

+470
-404
lines changed

23 files changed

+470
-404
lines changed

docs/reference/aggregations/metrics/percentile-aggregation.asciidoc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ percentiles: `[ 1, 5, 25, 50, 75, 95, 99 ]`. The response will look like this:
5353
"aggregations": {
5454
"load_time_outlier": {
5555
"values" : {
56-
"1.0": 9.9,
57-
"5.0": 29.500000000000004,
58-
"25.0": 167.5,
56+
"1.0": 5.0,
57+
"5.0": 25.0,
58+
"25.0": 165.0,
5959
"50.0": 445.0,
60-
"75.0": 722.5,
61-
"95.0": 940.5,
62-
"99.0": 980.1000000000001
60+
"75.0": 725.0,
61+
"95.0": 945.0,
62+
"99.0": 985.0
6363
}
6464
}
6565
}
@@ -129,31 +129,31 @@ Response:
129129
"values": [
130130
{
131131
"key": 1.0,
132-
"value": 9.9
132+
"value": 5.0
133133
},
134134
{
135135
"key": 5.0,
136-
"value": 29.500000000000004
136+
"value": 25.0
137137
},
138138
{
139139
"key": 25.0,
140-
"value": 167.5
140+
"value": 165.0
141141
},
142142
{
143143
"key": 50.0,
144144
"value": 445.0
145145
},
146146
{
147147
"key": 75.0,
148-
"value": 722.5
148+
"value": 725.0
149149
},
150150
{
151151
"key": 95.0,
152-
"value": 940.5
152+
"value": 945.0
153153
},
154154
{
155155
"key": 99.0,
156-
"value": 980.1000000000001
156+
"value": 985.0
157157
}
158158
]
159159
}

docs/reference/cat.asciidoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ GET /_cat/master?help
5555
--------------------------------------------------
5656
// CONSOLE
5757

58-
Might respond respond with:
58+
Might respond with:
5959

6060
[source,txt]
6161
--------------------------------------------------
@@ -66,6 +66,11 @@ node | n | node name
6666
--------------------------------------------------
6767
// TESTRESPONSE[s/[|]/[|]/ _cat]
6868

69+
NOTE: `help` is not supported if any optional url parameter is used.
70+
For example `GET _cat/shards/twitter?help` or `GET _cat/indices/twi*?help`
71+
results in an error. Use `GET _cat/shards?help` or `GET _cat/indices?help`
72+
instead.
73+
6974
[float]
7075
[[headers]]
7176
=== Headers

docs/reference/docs/get.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
The get API allows to get a typed JSON document from the index based on
55
its id. The following example gets a JSON document from an index called
6-
twitter, under a type called tweet, with id valued 0:
6+
twitter, under a type called _doc, with id valued 0:
77

88
[source,js]
99
--------------------------------------------------

docs/reference/indices/flush.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ which returns something similar to:
9898
"translog_uuid" : "hnOG3xFcTDeoI_kvvvOdNA",
9999
"history_uuid" : "XP7KDJGiS1a2fHYiFL5TXQ",
100100
"local_checkpoint" : "-1",
101-
"translog_generation" : "1",
101+
"translog_generation" : "2",
102102
"max_seq_no" : "-1",
103103
"sync_id" : "AVvFY-071siAOuFGEO9P", <1>
104104
"max_unsafe_auto_id_timestamp" : "-1"

docs/reference/mapping/types/nested.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The following parameters are accepted by `nested` fields:
184184
185185
Because nested documents are indexed as separate documents, they can only be
186186
accessed within the scope of the `nested` query, the
187-
`nested`/`reverse_nested`, or <<nested-inner-hits,nested inner hits>>.
187+
`nested`/`reverse_nested` aggregations, or <<nested-inner-hits,nested inner hits>>.
188188
189189
For instance, if a string field within a nested document has
190190
<<index-options,`index_options`>> set to `offsets` to allow use of the postings

modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Utils.java

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@
3838
import java.io.IOException;
3939
import java.util.ArrayList;
4040
import java.util.Collection;
41-
import java.util.Collections;
42-
import java.util.LinkedList;
4341
import java.util.List;
4442
import java.util.Locale;
4543
import java.util.Optional;
46-
import java.util.Queue;
4744
import java.util.concurrent.atomic.AtomicBoolean;
4845

4946
public class Netty4Utils {
@@ -171,7 +168,8 @@ public static void closeChannels(final Collection<Channel> channels) throws IOEx
171168
* @param cause the throwable to test
172169
*/
173170
public static void maybeDie(final Throwable cause) {
174-
final Optional<Error> maybeError = maybeError(cause);
171+
final Logger logger = ESLoggerFactory.getLogger(Netty4Utils.class);
172+
final Optional<Error> maybeError = ExceptionsHelper.maybeError(cause, logger);
175173
if (maybeError.isPresent()) {
176174
/*
177175
* Here be dragons. We want to rethrow this so that it bubbles up to the uncaught exception handler. Yet, Netty wraps too many
@@ -182,7 +180,6 @@ public static void maybeDie(final Throwable cause) {
182180
try {
183181
// try to log the current stack trace
184182
final String formatted = ExceptionsHelper.formatStackTrace(Thread.currentThread().getStackTrace());
185-
final Logger logger = ESLoggerFactory.getLogger(Netty4Utils.class);
186183
logger.error("fatal error on the network layer\n{}", formatted);
187184
} finally {
188185
new Thread(
@@ -194,40 +191,4 @@ public static void maybeDie(final Throwable cause) {
194191
}
195192
}
196193

197-
static final int MAX_ITERATIONS = 1024;
198-
199-
/**
200-
* Unwrap the specified throwable looking for any suppressed errors or errors as a root cause of the specified throwable.
201-
*
202-
* @param cause the root throwable
203-
*
204-
* @return an optional error if one is found suppressed or a root cause in the tree rooted at the specified throwable
205-
*/
206-
static Optional<Error> maybeError(final Throwable cause) {
207-
// early terminate if the cause is already an error
208-
if (cause instanceof Error) {
209-
return Optional.of((Error) cause);
210-
}
211-
212-
final Queue<Throwable> queue = new LinkedList<>();
213-
queue.add(cause);
214-
int iterations = 0;
215-
while (!queue.isEmpty()) {
216-
iterations++;
217-
if (iterations > MAX_ITERATIONS) {
218-
ESLoggerFactory.getLogger(Netty4Utils.class).warn("giving up looking for fatal errors on the network layer", cause);
219-
break;
220-
}
221-
final Throwable current = queue.remove();
222-
if (current instanceof Error) {
223-
return Optional.of((Error) current);
224-
}
225-
Collections.addAll(queue, current.getSuppressed());
226-
if (current.getCause() != null) {
227-
queue.add(current.getCause());
228-
}
229-
}
230-
return Optional.empty();
231-
}
232-
233194
}

modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4UtilsTests.java

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import io.netty.buffer.ByteBuf;
2323
import io.netty.buffer.CompositeByteBuf;
2424
import io.netty.buffer.Unpooled;
25-
import io.netty.handler.codec.DecoderException;
2625
import org.apache.lucene.util.BytesRef;
2726
import org.elasticsearch.common.bytes.AbstractBytesReferenceTestCase;
2827
import org.elasticsearch.common.bytes.BytesArray;
@@ -33,9 +32,6 @@
3332
import org.elasticsearch.test.ESTestCase;
3433

3534
import java.io.IOException;
36-
import java.util.Optional;
37-
38-
import static org.hamcrest.CoreMatchers.equalTo;
3935

4036
public class Netty4UtilsTests extends ESTestCase {
4137

@@ -79,60 +75,6 @@ public void testToChannelBuffer() throws IOException {
7975
assertArrayEquals(BytesReference.toBytes(ref), BytesReference.toBytes(bytesReference));
8076
}
8177

82-
public void testMaybeError() {
83-
final Error outOfMemoryError = new OutOfMemoryError();
84-
assertError(outOfMemoryError, outOfMemoryError);
85-
86-
final DecoderException decoderException = new DecoderException(outOfMemoryError);
87-
assertError(decoderException, outOfMemoryError);
88-
89-
final Exception e = new Exception();
90-
e.addSuppressed(decoderException);
91-
assertError(e, outOfMemoryError);
92-
93-
final int depth = randomIntBetween(1, 16);
94-
Throwable cause = new Exception();
95-
boolean fatal = false;
96-
Error error = null;
97-
for (int i = 0; i < depth; i++) {
98-
final int length = randomIntBetween(1, 4);
99-
for (int j = 0; j < length; j++) {
100-
if (!fatal && rarely()) {
101-
error = new Error();
102-
cause.addSuppressed(error);
103-
fatal = true;
104-
} else {
105-
cause.addSuppressed(new Exception());
106-
}
107-
}
108-
if (!fatal && rarely()) {
109-
cause = error = new Error(cause);
110-
fatal = true;
111-
} else {
112-
cause = new Exception(cause);
113-
}
114-
}
115-
if (fatal) {
116-
assertError(cause, error);
117-
} else {
118-
assertFalse(Netty4Utils.maybeError(cause).isPresent());
119-
}
120-
121-
assertFalse(Netty4Utils.maybeError(new Exception(new DecoderException())).isPresent());
122-
123-
Throwable chain = outOfMemoryError;
124-
for (int i = 0; i < Netty4Utils.MAX_ITERATIONS; i++) {
125-
chain = new Exception(chain);
126-
}
127-
assertFalse(Netty4Utils.maybeError(chain).isPresent());
128-
}
129-
130-
private void assertError(final Throwable cause, final Error error) {
131-
final Optional<Error> maybeError = Netty4Utils.maybeError(cause);
132-
assertTrue(maybeError.isPresent());
133-
assertThat(maybeError.get(), equalTo(error));
134-
}
135-
13678
private BytesReference getRandomizedBytesReference(int length) throws IOException {
13779
// we know bytes stream output always creates a paged bytes reference, we use it to create randomized content
13880
ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(length, bigarrays);

rest-api-spec/src/main/resources/rest-api-spec/test/indices.stats/20_translog.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ setup:
1515
- do:
1616
indices.stats:
1717
metric: [ translog ]
18-
- set: { indices.test.primaries.translog.size_in_bytes: empty_size }
18+
- set: { indices.test.primaries.translog.size_in_bytes: creation_size }
1919

2020
- do:
2121
index:
@@ -27,9 +27,11 @@ setup:
2727
- do:
2828
indices.stats:
2929
metric: [ translog ]
30-
- gt: { indices.test.primaries.translog.size_in_bytes: $empty_size }
30+
- gt: { indices.test.primaries.translog.size_in_bytes: $creation_size }
3131
- match: { indices.test.primaries.translog.operations: 1 }
32-
- gt: { indices.test.primaries.translog.uncommitted_size_in_bytes: $empty_size }
32+
# we can't check this yet as creation size will contain two empty translog generations. A single
33+
# non empty generation with one op may be smaller or larger than that.
34+
# - gt: { indices.test.primaries.translog.uncommitted_size_in_bytes: $creation_size }
3335
- match: { indices.test.primaries.translog.uncommitted_operations: 1 }
3436

3537
- do:
@@ -39,9 +41,10 @@ setup:
3941
- do:
4042
indices.stats:
4143
metric: [ translog ]
42-
- gt: { indices.test.primaries.translog.size_in_bytes: $empty_size }
44+
- gt: { indices.test.primaries.translog.size_in_bytes: $creation_size }
4345
- match: { indices.test.primaries.translog.operations: 1 }
44-
- match: { indices.test.primaries.translog.uncommitted_size_in_bytes: $empty_size }
46+
## creation translog size has some overhead due to an initial empty generation that will be trimmed later
47+
- lt: { indices.test.primaries.translog.uncommitted_size_in_bytes: $creation_size }
4548
- match: { indices.test.primaries.translog.uncommitted_operations: 0 }
4649

4750
- do:
@@ -59,7 +62,8 @@ setup:
5962
- do:
6063
indices.stats:
6164
metric: [ translog ]
62-
- match: { indices.test.primaries.translog.size_in_bytes: $empty_size }
65+
## creation translog size has some overhead due to an initial empty generation that will be trimmed later
66+
- lte: { indices.test.primaries.translog.size_in_bytes: $creation_size }
6367
- match: { indices.test.primaries.translog.operations: 0 }
64-
- match: { indices.test.primaries.translog.uncommitted_size_in_bytes: $empty_size }
68+
- lte: { indices.test.primaries.translog.uncommitted_size_in_bytes: $creation_size }
6569
- match: { indices.test.primaries.translog.uncommitted_operations: 0 }

0 commit comments

Comments
 (0)