Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration test class, ITFastOpenTest, to verify the fast open read functionality for Google Cloud Storage under various scenarios, including partial reads, large objects, and error conditions. The feedback recommends managing the OpenTelemetrySdk instance inside a try-with-resources block in the bytes_areServedFromTheOpen test to ensure it is properly closed and to prevent potential resource leaks.
| OpenTelemetrySdk.builder() | ||
| .setTracerProvider( | ||
| SdkTracerProvider.builder() | ||
| .addSpanProcessor(SimpleSpanProcessor.create(exporter)) | ||
| .build()) | ||
| .build(); | ||
|
|
||
| try (Storage traced = | ||
| storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService(); | ||
| BlobReadSession session = traced.blobReadSession(blobId, READ_10_TO_20).get(30, SECONDS)) { | ||
| byte[] actual = session.readAs(READ_10_TO_20).get(30, SECONDS); |
There was a problem hiding this comment.
The OpenTelemetrySdk instance is not closed after the test finishes. Since OpenTelemetrySdk implements AutoCloseable, it should be managed within a try-with-resources block to ensure that its tracer provider and associated span processors are properly shut down and do not leak resources (such as threads or memory) between test runs.
| OpenTelemetrySdk.builder() | |
| .setTracerProvider( | |
| SdkTracerProvider.builder() | |
| .addSpanProcessor(SimpleSpanProcessor.create(exporter)) | |
| .build()) | |
| .build(); | |
| try (Storage traced = | |
| storage.getOptions().toBuilder().setOpenTelemetry(otel).build().getService(); | |
| BlobReadSession session = traced.blobReadSession(blobId, READ_10_TO_20).get(30, SECONDS)) { | |
| byte[] actual = session.readAs(READ_10_TO_20).get(30, SECONDS); | |
| 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, READ_10_TO_20).get(30, SECONDS)) { |
References
- Use try-with-resources to manage closeable resources in tests to ensure they are safely closed and prevent resource leaks.
da9302e to
e1a8b2f
Compare
e740d72 to
540e2ca
Compare
Ninth step of fast open BiDi reads (go/fast-open-bidi-read, b/552263062). ITFastOpenTest runs fast open against a zonal (RAPID) bucket on production: - byte array, ByteString and channel reads; the byte array test also checks with tracing that readAs was served from the open (cache_status HIT) - a 16 MiB read that arrives in many responses - more reads on the same session - a read starting exactly at the end of the object (empty) - a read past the end of the object - an object that doesn't exist (404) and a failed precondition (412) - closing the session without claiming the fast open read Production reports a fast open read past the end of the object on that read only: the open succeeds and the matching readAs fails with OUT_OF_RANGE. The test pins this.
540e2ca to
6bd1b9a
Compare
e1a8b2f to
1e3110b
Compare
9/n of fast open BiDi reads
ITFastOpenTest runs fast open against a zonal bucket on production: