Skip to content

Pass the chunk length to NewReader() when reading chunks. - #231

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1009621243
Nov 20, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1009621243

Conversation

@copybara-service

Copy link
Copy Markdown

Pass the chunk length to NewReader() when reading chunks.

Chunk reads create a child reader with NewReader(offset) and read the chunk
with MaskedReader. They now use NewReader(offset, length_hint) with the
length being read, so that riegeli::GcsReader sends one request for exactly
this range instead of an open-ended request which is cancelled after the chunk
is read. Sources which do not use the hint, e.g. FileReader, FdReader, and
StringReader, read as before.

With index_storage_option:offloaded, each chunk offset lookup reads the
footer chunk with DefaultChunkReader. Its length, measured when the footer is
read by Initialize(), is passed too, so these lookups no longer send an
open-ended request each which is cancelled before the footer padding and
postscript are read.

@google-cla

google-cla Bot commented Oct 30, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
copybara-service Bot force-pushed the test_1009621243 branch 3 times, most recently from a07b183 to b13edbc Compare November 20, 2026 13:02
Chunk reads create a child reader with `NewReader(offset)` and read the chunk
with `MaskedReader`. They now use `NewReader(offset, length_hint)` with the
length being read, so that `riegeli::GcsReader` sends one request for exactly
this range instead of an open-ended request which is cancelled after the chunk
is read. Sources which do not use the hint, e.g. `FileReader`, `FdReader`, and
`StringReader`, read as before.

With `index_storage_option:offloaded`, each chunk offset lookup reads the
footer chunk with `DefaultChunkReader`. Its length, measured when the footer is
read by `Initialize()`, is passed too, so these lookups no longer send an
open-ended request each which is cancelled before the footer padding and
postscript are read.

PiperOrigin-RevId: 1026412932
@copybara-service
copybara-service Bot merged commit 0d7f050 into main Nov 20, 2026
2 of 3 checks passed
@copybara-service
copybara-service Bot deleted the test_1009621243 branch November 20, 2026 13:51
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.

0 participants