Skip to content

Commit 8ced682

Browse files
authored
Add temporary logging for #125668 (#125749)
This failure doesn't reproduce locally after repeated attempts. Unmuting it in CI with some additional logging, to be reverted ASAP.
1 parent 36c14bf commit 8ced682

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,6 @@ tests:
378378
- class: org.elasticsearch.smoketest.MlWithSecurityIT
379379
method: test {yaml=ml/data_frame_analytics_cat_apis/Test cat data frame analytics single job with header}
380380
issue: https://github.com/elastic/elasticsearch/issues/125642
381-
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.GCSRepositoryAnalysisRestIT
382-
method: testRepositoryAnalysis
383-
issue: https://github.com/elastic/elasticsearch/issues/125668
384381
- class: org.elasticsearch.packaging.test.DockerTests
385382
method: test010Install
386383
issue: https://github.com/elastic/elasticsearch/issues/125680

server/src/main/java/org/elasticsearch/common/blobstore/support/BlobContainerUtils.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99

1010
package org.elasticsearch.common.blobstore.support;
1111

12+
import org.apache.logging.log4j.Level;
13+
import org.apache.logging.log4j.LogManager;
14+
import org.apache.logging.log4j.Logger;
15+
import org.elasticsearch.common.ReferenceDocs;
1216
import org.elasticsearch.common.Strings;
1317
import org.elasticsearch.common.blobstore.BlobContainer;
1418
import org.elasticsearch.common.bytes.BytesArray;
1519
import org.elasticsearch.common.bytes.BytesReference;
20+
import org.elasticsearch.common.logging.ChunkedLoggingStream;
21+
import org.elasticsearch.common.unit.ByteSizeUnit;
1622

1723
import java.io.IOException;
1824
import java.io.InputStream;
@@ -32,6 +38,8 @@ public static void ensureValidRegisterContent(BytesReference bytesReference) {
3238
}
3339
}
3440

41+
private static final Logger logger = LogManager.getLogger(BlobContainerUtils.class);
42+
3543
/**
3644
* Many blob stores have consistent (linearizable/atomic) read semantics and in these casees it is safe to implement {@link
3745
* BlobContainer#getRegister} by simply reading the blob using this utility.
@@ -51,7 +59,28 @@ public static BytesReference getRegisterUsingConsistentRead(InputStream inputStr
5159
len -= read;
5260
pos += read;
5361
}
54-
if (inputStream.read() != -1) {
62+
final int nextByte = inputStream.read();
63+
if (nextByte != -1) {
64+
try (
65+
var cls = ChunkedLoggingStream.create(
66+
logger,
67+
Level.ERROR,
68+
"getRegisterUsingConsistentRead including trailing data",
69+
ReferenceDocs.LOGGING
70+
)
71+
) {
72+
cls.write(bytes);
73+
cls.write(nextByte);
74+
final var buffer = new byte[ByteSizeUnit.KB.toIntBytes(1)];
75+
while (true) {
76+
final var readSize = inputStream.read(buffer);
77+
if (readSize == -1) {
78+
break;
79+
}
80+
cls.write(buffer, 0, readSize);
81+
}
82+
}
83+
5584
throw new IllegalStateException(
5685
Strings.format("[%s] failed reading register [%s] due to unexpected trailing data", container, key)
5786
);

0 commit comments

Comments
 (0)