pub struct Coordinator { /* private fields */ }Expand description
The query coordinator (spec section 12.10): registers the query with the
existing SqlQueryRegistry (so registry.cancel(...) reaches every
fragment through the ExecutionControl hierarchy), reserves resources
per fragment, fans out cancellation to every fragment, sweeps expired
worker leases to clean abandoned fragments, and merges producer streams
per the exchange descriptors with the real in-memory operators.
Implementations§
Source§impl Coordinator
impl Coordinator
Sourcepub fn new(
transport: Arc<dyn FragmentTransport>,
registry: Arc<SqlQueryRegistry>,
) -> Self
pub fn new( transport: Arc<dyn FragmentTransport>, registry: Arc<SqlQueryRegistry>, ) -> Self
A coordinator with default limits (1024 concurrent fragments, 16 GiB of estimated bytes, 30 second worker leases).
Sourcepub fn with_limits(
transport: Arc<dyn FragmentTransport>,
registry: Arc<SqlQueryRegistry>,
max_fragments: usize,
max_bytes: u64,
lease_ttl: Duration,
) -> Self
pub fn with_limits( transport: Arc<dyn FragmentTransport>, registry: Arc<SqlQueryRegistry>, max_fragments: usize, max_bytes: u64, lease_ttl: Duration, ) -> Self
A coordinator with explicit resource limits and lease TTL.
Sourcepub fn resources(&self) -> &Arc<ResourceLedger> ⓘ
pub fn resources(&self) -> &Arc<ResourceLedger> ⓘ
The fragment resource ledger (test introspection).
Sourcepub async fn execute(
&self,
plan: &DistributedPlan,
) -> DistributedResult<Vec<RecordBatch>>
pub async fn execute( &self, plan: &DistributedPlan, ) -> DistributedResult<Vec<RecordBatch>>
Executes a distributed plan to completion, returning the root fragment’s output batches.
The plan’s QueryId is registered with the query registry first;
every fragment runs under a child ExecutionControl of that
registration, so a registry-level cancel fans out to all fragments.
Fragments execute layer by layer (producers before consumers),
concurrently within a layer. The coordinator-local root fragment’s
merge operators (FragmentOperator::MergeSort,
FragmentOperator::FinalAggregate,
FragmentOperator::DistributedTopK,
FragmentOperator::DistributedLimit) run over the producer streams
for real.
Sourcepub fn cancel_query(&self, query_id: &QueryId) -> DistributedResult<bool>
pub fn cancel_query(&self, query_id: &QueryId) -> DistributedResult<bool>
Cancels a running distributed query: registry cancel (which reaches every fragment control through the parent-child hierarchy) plus an explicit transport cancel per in-flight fragment (spec section 12.10: “cancellation fans out to every fragment”). Returns true when the registry accepted (or already observed) the cancellation.
Sourcepub fn sweep_expired_leases(&self, now: Instant) -> usize
pub fn sweep_expired_leases(&self, now: Instant) -> usize
Sweeps expired worker leases and cleans their abandoned in-flight
fragments: cancels the fragment control (as
CancellationReason::ServerShutdown), notifies the transport, and
releases the resource reservation (spec section 12.10: “worker lease
expiry cleans abandoned fragments”). Returns the number of fragments
cleaned.
Auto Trait Implementations§
impl !Freeze for Coordinator
impl !RefUnwindSafe for Coordinator
impl !UnwindSafe for Coordinator
impl Send for Coordinator
impl Sync for Coordinator
impl Unpin for Coordinator
impl UnsafeUnpin for Coordinator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more