Skip to content

test(storage): fast open integration tests with several reads - #14883

Open
Dhriti07 wants to merge 2 commits into
fast-open/12-public-api-listfrom
fast-open/13-multi-range-live-tests
Open

Dhriti07 wants to merge 2 commits into
fast-open/12-public-api-listfrom
fast-open/13-multi-range-live-tests

Conversation

@Dhriti07

@Dhriti07 Dhriti07 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

13/n of fast open BiDi reads

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

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +163 to +168
try (Storage traced = tracedStorage(exporter);
BlobReadSession session =
traced
.blobReadSession(
blobId, ImmutableList.of(bytes0To10, byteString100To110, bytes1000To1010))
.get(30, SECONDS)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Use try-with-resources to manage closeable resources in tests to ensure they are safely closed and prevent resource leaks.

@Dhriti07
Dhriti07 marked this pull request as ready for review November 9, 2026 07:06
@Dhriti07
Dhriti07 requested review from a team as code owners November 9, 2026 07:06
@Dhriti07
Dhriti07 requested a review from ShreyasSinha November 9, 2026 07:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant