Skip to main content

Coordinator

Struct Coordinator 

Source
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

Source

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).

Source

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.

Source

pub fn resources(&self) -> &Arc<ResourceLedger>

The fragment resource ledger (test introspection).

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V