Skip to content

Commit d378185

Browse files
authored
Fix GCS tests broken by idempotency token (#126972)
1 parent 270ca0a commit d378185

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

modules/repository-gcs/src/internalClusterTest/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,15 @@ protected String requestUniqueId(HttpExchange exchange) {
343343
}
344344

345345
if (exchange.getRequestHeaders().containsKey(IDEMPOTENCY_TOKEN)) {
346-
return exchange.getRequestHeaders().getFirst(IDEMPOTENCY_TOKEN);
346+
String idempotencyToken = exchange.getRequestHeaders().getFirst(IDEMPOTENCY_TOKEN);
347+
// In the event of a resumable retry, the GCS client uses the same idempotency token for
348+
// the retry status check and the subsequent retries.
349+
// Including the range header allows us to disambiguate between the requests
350+
// see https://github.com/googleapis/java-storage/issues/3040
351+
if (exchange.getRequestHeaders().containsKey("Content-Range")) {
352+
idempotencyToken += " " + exchange.getRequestHeaders().getFirst("Content-Range");
353+
}
354+
return idempotencyToken;
347355
}
348356

349357
final String range = exchange.getRequestHeaders().getFirst("Content-Range");

muted-tests.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,18 +405,6 @@ tests:
405405
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
406406
method: test {p0=ml/inference_crud/Test delete given unused trained model}
407407
issue: https://github.com/elastic/elasticsearch/issues/126881
408-
- class: org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests
409-
method: testRequestStats
410-
issue: https://github.com/elastic/elasticsearch/issues/126902
411-
- class: org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests
412-
method: testWriteReadLarge
413-
issue: https://github.com/elastic/elasticsearch/issues/126903
414-
- class: org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests
415-
method: testWriteFileMultipleOfChunkSize
416-
issue: https://github.com/elastic/elasticsearch/issues/126908
417-
- class: org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests
418-
method: testSnapshotWithLargeSegmentFiles
419-
issue: https://github.com/elastic/elasticsearch/issues/126909
420408
- class: org.elasticsearch.index.engine.CompletionStatsCacheTests
421409
method: testCompletionStatsCache
422410
issue: https://github.com/elastic/elasticsearch/issues/126910

0 commit comments

Comments
 (0)