Skip to content

refactor(replica): move resumable reader internal#1081

Closed
corylanou wants to merge 2 commits intomainfrom
codex/pr-1080-resumable-reader-internal
Closed

refactor(replica): move resumable reader internal#1081
corylanou wants to merge 2 commits intomainfrom
codex/pr-1080-resumable-reader-internal

Conversation

@corylanou
Copy link
Collaborator

@corylanou corylanou commented Feb 3, 2026

Summary

Move the ResumableReader helper into the internal package and relocate its tests, keeping restore behavior unchanged.

Problem

PR #1080 introduced an exported ResumableReader in the main litestream package primarily for testing. Ben suggested moving it to internal to avoid cluttering the public API.

Solution

Relocate ResumableReader and its tests to internal/ and update restore to use internal.NewResumableReader.

Scope

In scope:

  • Move ResumableReader implementation to internal
  • Move ResumableReader tests to internal
  • Update restore path to use the internal helper

Not in scope:

  • Changes to restore behavior or retry semantics
  • Any provider-specific changes

Test Plan

  • go test ./...
  • go test -race ./...

Related

emschwartz and others added 2 commits February 3, 2026 10:38
…restores

During restore of large databases (~55 GB), the LTX compactor opens all
S3 streams upfront but processes pages in page-number order. Incremental
LTX files with high-numbered pages sit idle for minutes while lower pages
are processed from the snapshot. Storage providers (S3, Tigris) close
these idle connections, causing "unexpected EOF" errors.

Wrap each LTX file stream in a ResumableReader that detects connection
drops (both non-EOF errors and premature EOF) and transparently reopens
from the current byte offset using range requests. Partial reads are
returned without error so callers like io.ReadFull continue seamlessly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@corylanou
Copy link
Collaborator Author

Closing in favor of #1082 which includes this refactor along with integration tests.

@corylanou corylanou closed this Feb 4, 2026
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.

2 participants