Repository navigation
Conversation
Thirteenth step of fast open BiDi reads (go/fast-open-bidi-read, b/552263062). Adds production tests to ITFastOpenTest for several fast open reads on a zonal bucket: - three ranges (byte array and ByteString) are all served from the open, checked with tracing (cache_status HIT for each) - two of four ranges start past the end of the object: the other two return their bytes and only those two readAs fail with OUT_OF_RANGE - a whole 16 MiB object plus two small ranges: every read is correct Checked on production before writing these: the server sends the good ranges first and then reports all bad ranges in one error, with no extra re-open; and small ranges arrive before a large one in the same open.
There was a problem hiding this comment.
Code Review
This pull request adds three new integration tests to ITFastOpenTest.java to verify reading multiple ranges, handling out-of-range reads, and handling large ranges spanning multiple responses. It also introduces a helper method tracedStorage to configure an OpenTelemetry-traced storage instance. The review feedback recommends managing the lifecycle of OpenTelemetrySdk using try-with-resources to prevent potential resource leaks.
| try (Storage traced = tracedStorage(exporter); | ||
| BlobReadSession session = | ||
| traced | ||
| .blobReadSession( | ||
| blobId, ImmutableList.of(bytes0To10, byteString100To110, bytes1000To1010)) | ||
| .get(30, SECONDS)) { |
There was a problem hiding this comment.
The OpenTelemetrySdk instance created in tracedStorage is never closed, which can lead to resource leaks (such as threads or exporters) when running tests. Since OpenTelemetrySdk implements AutoCloseable, we should manage its lifecycle using try-with-resources. We can inline the creation of OpenTelemetrySdk and traced directly in the try-with-resources block, which also allows us to remove the helper method tracedStorage if it's not used elsewhere.
try (OpenTelemetrySdk otel =
OpenTelemetrySdk.builder()
.setTracerProvider(
SdkTracerProvider.builder()
.addSpanProcessor(SimpleSpanProcessor.create(exporter))
.build())
.build();
Storage traced =
storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService();
BlobReadSession session =
traced
.blobReadSession(
blobId, ImmutableList.of(bytes0To10, byteString100To110, bytes1000To1010))
.get(30, SECONDS)) {References
- Use try-with-resources to manage closeable resources in tests to ensure they are safely closed and prevent resource leaks.
13/n of fast open BiDi reads
Adds production tests to ITFastOpenTest for several fast open reads on a zonal bucket: