[Rust][Arrow] Move explicit close into supervisor - #680
Open
teodordelibasic-db wants to merge 9 commits into
Open
[Rust][Arrow] Move explicit close into supervisor#680teodordelibasic-db wants to merge 9 commits into
teodordelibasic-db wants to merge 9 commits into
Conversation
teodordelibasic-db
force-pushed
the
effort/zerobus-sdk-supervisor-owned-close
branch
2 times, most recently
from
August 6, 2026 14:33
a4094a4 to
f54f167
Compare
teodordelibasic-db
force-pushed
the
effort/zerobus-sdk-supervisor-owned-close
branch
4 times, most recently
from
August 7, 2026 12:16
210d399 to
6a51383
Compare
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
teodordelibasic-db
force-pushed
the
effort/zerobus-sdk-supervisor-owned-close
branch
2 times, most recently
from
August 7, 2026 13:48
8426691 to
fee72c8
Compare
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
teodordelibasic-db
force-pushed
the
effort/zerobus-sdk-supervisor-owned-close
branch
from
August 7, 2026 13:54
fee72c8 to
0e87af3
Compare
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
Signed-off-by: teodordelibasic-db <teodor.delibasic@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
Arrow explicit close previously depended on caller-side flush completion before supervisor teardown could begin. During recovery, that allowed backoff, reconnect setup, ready-signal waiting, credential invalidation, or replay to continue until a separate timeout resolved the phase.
This PR moves explicit-close coordination and finalization into the Arrow stream supervisor. The close target and original deadline are published together while holding the ingestion mutex, and the supervisor owns the single teardown.
close()publishes an irreversible close request; if that future is cancelled, ingestion remains closed and callers must invokeclose()again to await completion.close()cannot hang and unacknowledged batches remain retrievable.This is an internal Rust SDK lifecycle change. It does not change public APIs, FFI signatures, ABI, or semver compatibility.
Remaining intentional limitations:
Fixes #657.
How is this tested?
test_close_publication_preserves_target_ack_precedence: publishes close while terminal finalization is parked after a target ACK, aborts the supervisor after outcome selection, and verifies that fallback preserves the acknowledged-target result over the following peer error.test_close_does_not_cancel_received_ack_application: verifies close lets a consumed ACK finish applying before selecting the terminal outcome.test_close_finalizes_after_supervisor_abort: verifies abnormal supervisor exit cannot leave close hanging and preserves the unacknowledged batch for retrieval.test_supervisor_abort_preserves_post_deadline_timeout: applies a late ACK during post-deadline drain, aborts after the timeout outcome is selected, and verifies fallback preserves that timeout while retaining the ACK for pending-batch accounting.test_close_skips_flush_wait_after_request_send_failure: verifies an already-failed active transport bypasses the remaining flush wait and that a retryable post-EOF drain error does not mask the original request-send failure.test_expired_close_timeout_drains_post_eof_error: verifies an expired flush deadline still receives a bounded post-EOF drain and preserves a concrete peer rejection over the flush timeout.test_expired_close_timeout_applies_post_eof_ack_without_succeeding: verifies a post-EOF ACK still clears acknowledged pending work after the flush deadline without retroactively turning the timed-out close into success.test_close_during_rotation_drain_preserves_peer_error: verifies close does not lose a permanent peer status already received by an in-progress rotation drain.close_during_rotation_ack_wait_preserves_rotation_state: verifies target-already-acknowledged, deadline-expired, and target-acknowledged-after-publication closes remain in the active rotation state, including a deterministic tie where the ACK and close deadline are both ready.deadline_driven_close_drain_reports_flush_timeout: verifies a deadline-driven rotation drain retains the close flush-timeout classification.test_rotation_close_timeout_survives_late_drain_ack: uses a positive close timeout and an absolute post-publication deadline while parking target-ACK application during rotation drain, then verifies close reports the flush timeout while retaining the ACK for pending-batch accounting.test_close_flush_overlapping_rotation_drains_once: publishes close before a delayed rotation signal, then verifies the nested flush path completes from that rotation's post-EOF ACK without panicking, reconnecting, or draining the transport twice.test_close_after_reconnect_timeout_preserves_timeout_error: publishes close immediately after reconnect timeout wins and verifies the timeout remains the terminal outcome.test_published_close_preserves_recovery_trigger_over_retryable_reconnect_failure: verifies a teardown-induced retryable reconnect failure does not mask the error that started recovery.test_published_close_still_invalidates_rejected_reconnect_credentials: verifies an authentication rejection invalidates cached credentials even when close was already published.test_close_preserves_reconnect_auth_rejection_while_invalidation_completes: verifies close returns the authentication rejection promptly while the independently owned invalidation finishes afterward.test_close_does_not_cancel_terminal_auth_invalidation: races close with an active authentication rejection and verifies the single invalidation survives both finalization and stream drop.cancelled_reconnect_commit_does_not_publish_sender: verifies cancellation while reconnect commit is waiting cannot publish a replacement sender or unpause ingestion.test_close_interrupts_recovery_backoff: verifies close interrupts a parked recovery backoff and preserves the triggering error.test_close_interrupts_reconnect_setup_and_ready_wait: verifies close interrupts both a blocked reconnect handshake and ready-signal wait.test_close_during_reconnect_rebuild_and_partial_replay_retains_exact_unacked_suffixes: verifies close retains the exact durable-watermark suffix both before range rebasing and during partial replay.test_cancelled_close_rejects_ingest_and_resumes_teardown: verifies cancelling the first close future leaves the request active and a repeated call resumes with the original deadline and result.test_empty_stream_close_preserves_terminal_error: verifies closing an empty stream preserves an existing terminal error.test_idempotent_close: verifies a clean empty stream with a zero close deadline closes successfully and repeated close returns the stored outcome.test_unrepresentable_ack_and_flush_timeouts_are_rejected: verifies stream creation rejects ACK and flush timeouts that cannot form platform deadlines.test_unrepresentable_runtime_recovery_deadline_is_rejected: verifies recovery reports an invalid timeout configuration without masking the error that triggered recovery during close.pause_and_detach_waits_for_in_flight_ingest: verifies sender detachment waits for an in-flight ingestion critical section.finalize_closed_waits_for_in_flight_ingest: verifies finalization includes a batch accepted by in-flight ingestion.