pub struct BarrierInner<M> {
pub epoch: EpochPair,
pub mutation: M,
pub kind: BarrierKind,
pub tracing_context: TracingContext,
pub passed_actors: Vec<ActorId>,
}
Expand description
The generic type M
is the mutation type of the barrier.
For barrier of in the dispatcher, M
is ()
, which means the mutation is erased.
For barrier flowing within the streaming actor, M
is the normal BarrierMutationType
.
Fields§
§epoch: EpochPair
§mutation: M
§kind: BarrierKind
§tracing_context: TracingContext
Tracing context for the current epoch of this barrier.
passed_actors: Vec<ActorId>
The actors that this barrier has passed locally. Used for debugging only.
Implementations§
source§impl<M: Default> BarrierInner<M>
impl<M: Default> BarrierInner<M>
sourcepub fn new_test_barrier(epoch: u64) -> Self
pub fn new_test_barrier(epoch: u64) -> Self
Create a plain barrier.
pub fn with_prev_epoch_for_test(epoch: u64, prev_epoch: u64) -> Self
source§impl BarrierInner<Option<Arc<Mutation>>>
impl BarrierInner<Option<Arc<Mutation>>>
pub fn into_dispatcher(self) -> DispatcherBarrier
pub fn with_mutation(self, mutation: Mutation) -> Self
pub fn with_stop(self) -> Self
sourcepub fn is_with_stop_mutation(&self) -> bool
pub fn is_with_stop_mutation(&self) -> bool
Whether this barrier carries stop mutation.
sourcepub fn is_stop(&self, actor_id: ActorId) -> bool
pub fn is_stop(&self, actor_id: ActorId) -> bool
Whether this barrier is to stop the actor with actor_id
.
sourcepub fn initial_split_assignment(
&self,
actor_id: ActorId,
) -> Option<&[SplitImpl]>
pub fn initial_split_assignment( &self, actor_id: ActorId, ) -> Option<&[SplitImpl]>
Get the initial split assignments for the actor with actor_id
.
This should only be called on the initial barrier received by the executor. It must be
Add
mutation when it’s a new streaming job, or recovery.Update
mutation when it’s created for scaling.AddAndUpdate
mutation when it’s created for sink-into-table.
Note that SourceChangeSplit
is not included, because it’s only used for changing splits
of existing executors.
sourcepub fn all_stop_actors(&self) -> Option<&HashSet<ActorId>>
pub fn all_stop_actors(&self) -> Option<&HashSet<ActorId>>
Get all actors that to be stopped (dropped) by this barrier.
sourcepub fn is_newly_added(&self, actor_id: ActorId) -> bool
pub fn is_newly_added(&self, actor_id: ActorId) -> bool
Whether this barrier is to newly add the actor with actor_id
. This is used for Chain
and
Values
to decide whether to output the existing (historical) data.
By “newly”, we mean the actor belongs to a subgraph of a new streaming job. That is, actors added for scaling are not included.
sourcepub fn has_more_downstream_fragments(&self, upstream_actor_id: ActorId) -> bool
pub fn has_more_downstream_fragments(&self, upstream_actor_id: ActorId) -> bool
Whether this barrier adds new downstream fragment for the actor with upstream_actor_id
.
§Use case
Some optimizations are applied when an actor doesn’t have any downstreams (“standalone” actors).
- Pause a standalone shared
SourceExecutor
. - Disable a standalone
MaterializeExecutor
’s conflict check.
This is implemented by checking actor_context.initial_dispatch_num
on startup, and
check has_more_downstream_fragments
on barrier to see whether the optimization
needs to be turned off.
§Some special cases not included
Note that this is not has_new_downstream_actor/fragment
. For our use case, we only
care about number of downstream fragments (more precisely, existence).
- When scaling, the number of downstream actors is changed, and they are “new”, but downstream fragments is not changed.
- When
ALTER TABLE sink_into_table
, the fragment is replaced with a “new” one, but the number is not changed.
sourcepub fn is_pause_on_startup(&self) -> bool
pub fn is_pause_on_startup(&self) -> bool
Whether this barrier requires the executor to pause its data stream on startup.
sourcepub fn as_update_merge(
&self,
actor_id: ActorId,
upstream_fragment_id: FragmentId,
) -> Option<&MergeUpdate>
pub fn as_update_merge( &self, actor_id: ActorId, upstream_fragment_id: FragmentId, ) -> Option<&MergeUpdate>
Returns the MergeUpdate
if this barrier is to update the merge executors for the actor
with actor_id
.
sourcepub fn as_update_vnode_bitmap(&self, actor_id: ActorId) -> Option<Arc<Bitmap>>
pub fn as_update_vnode_bitmap(&self, actor_id: ActorId) -> Option<Arc<Bitmap>>
Returns the new vnode bitmap if this barrier is to update the vnode bitmap for the actor
with actor_id
.
Actually, this vnode bitmap update is only useful for the record accessing validation for distributed executors, since the read/write pattern will never be across multiple vnodes.
pub fn get_curr_epoch(&self) -> Epoch
sourcepub fn tracing_context(&self) -> &TracingContext
pub fn tracing_context(&self) -> &TracingContext
Retrieve the tracing context for the current epoch of this barrier.
pub fn added_subscriber_on_mv_table( &self, mv_table_id: TableId, ) -> impl Iterator<Item = u32> + '_
source§impl<M> BarrierInner<M>
impl<M> BarrierInner<M>
fn to_protobuf_inner( &self, barrier_fn: impl FnOnce(&M) -> Option<PbMutation>, ) -> PbBarrier
fn from_protobuf_inner( prost: &PbBarrier, mutation_from_pb: impl FnOnce(Option<&PbMutation>) -> StreamExecutorResult<M>, ) -> StreamExecutorResult<Self>
pub fn map_mutation<M2>(self, f: impl FnOnce(M) -> M2) -> BarrierInner<M2>
source§impl BarrierInner<()>
impl BarrierInner<()>
pub fn to_protobuf(&self) -> PbBarrier
source§impl BarrierInner<Option<Arc<Mutation>>>
impl BarrierInner<Option<Arc<Mutation>>>
pub fn to_protobuf(&self) -> PbBarrier
pub fn from_protobuf(prost: &PbBarrier) -> StreamExecutorResult<Self>
Trait Implementations§
source§impl<M: Clone> Clone for BarrierInner<M>
impl<M: Clone> Clone for BarrierInner<M>
source§fn clone(&self) -> BarrierInner<M>
fn clone(&self) -> BarrierInner<M>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<M: Debug> Debug for BarrierInner<M>
impl<M: Debug> Debug for BarrierInner<M>
source§impl<M: PartialEq> PartialEq for BarrierInner<M>
impl<M: PartialEq> PartialEq for BarrierInner<M>
Auto Trait Implementations§
impl<M> Freeze for BarrierInner<M>where
M: Freeze,
impl<M> !RefUnwindSafe for BarrierInner<M>
impl<M> Send for BarrierInner<M>where
M: Send,
impl<M> Sync for BarrierInner<M>where
M: Sync,
impl<M> Unpin for BarrierInner<M>where
M: Unpin,
impl<M> !UnwindSafe for BarrierInner<M>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
§impl<T, U, I> LiftInto<U, I> for Twhere
U: LiftFrom<T, I>,
impl<T, U, I> LiftInto<U, I> for Twhere
U: LiftFrom<T, I>,
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<Source> Sculptor<HNil, HNil> for Source
impl<Source> Sculptor<HNil, HNil> for Source
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.