Skip to content

[Rust][Arrow] Use typed reconnect outcomes for close interruption #679

Description

@teodordelibasic-db

Summary

PR #677 coordinates Arrow explicit close with recovery. Its scoped fix represents a close that wins during replay commit with a private StreamClosedError sentinel, then recognizes that sentinel even if the close watch state has not been published yet.

That is correct with the current error provenance: reconnect peer failures are wrapped as CreateStreamError, while the private marker and other SDK-generated replay failures use distinct StreamClosedError values. Longer term, local control flow should not be encoded as an error status and exact message.

Proposed design

Use private typed outcomes for successful reconnect work that is interrupted by local close:

enum ReconnectOutcome {
    Connected {
        response_stream: FlightResponseStream,
        request_body: RequestBodyControl,
    },
    InterruptedByClose,
}

enum CommitOutcome {
    Committed,
    InterruptedByClose,
}
  • reconnect() returns Result<ReconnectOutcome, ZerobusError>.
  • commit_reconnect_after_replay() returns Result<CommitOutcome, ZerobusError>.
  • Real transport, authentication, ready-signal, and replay failures remain Err(ZerobusError).
  • A local close interruption returns the typed internal outcome, and the supervisor preserves the original recovery error when finalizing.

Why

  • Eliminate string-sentinel matching from reconnect control flow.
  • Prevent future retry misclassification or accidental sentinel leakage.
  • Make close interruption independent of watch publication timing.
  • Keep peer errors structurally distinct from local cancellation.
  • Make reconnect/close error precedence explicit in the type system.

The enums are private implementation details, so this has no public API, FFI, ABI, or semver impact.

Acceptance criteria

  • Remove the private close-cancellation status/message sentinel.
  • Model replay-commit interruption as a typed internal outcome.
  • Preserve real reconnect failures as ZerobusError values.
  • Preserve the original recovery error when close interrupts replay commit.
  • Add focused coverage distinguishing local close interruption from a peer Cancelled status.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions