pub struct DdlController {
pub(crate) env: MetaSrvEnv,
pub(crate) metadata_manager: MetadataManager,
pub(crate) stream_manager: GlobalStreamManagerRef,
pub(crate) source_manager: SourceManagerRef,
barrier_manager: BarrierManagerRef,
pub(crate) creating_streaming_job_permits: Arc<CreatingStreamingJobPermit>,
}
Fields§
§env: MetaSrvEnv
§metadata_manager: MetadataManager
§stream_manager: GlobalStreamManagerRef
§source_manager: SourceManagerRef
§barrier_manager: BarrierManagerRef
§creating_streaming_job_permits: Arc<CreatingStreamingJobPermit>
Implementations§
source§impl DdlController
impl DdlController
pub async fn new( env: MetaSrvEnv, metadata_manager: MetadataManager, stream_manager: GlobalStreamManagerRef, source_manager: SourceManagerRef, barrier_manager: BarrierManagerRef, ) -> Self
sourcepub async fn run_command(
&self,
command: DdlCommand,
) -> MetaResult<Option<WaitVersion>>
pub async fn run_command( &self, command: DdlCommand, ) -> MetaResult<Option<WaitVersion>>
run_command
spawns a tokio coroutine to execute the target ddl command. When the client
has been interrupted during executing, the request will be cancelled by tonic. Since we have
a lot of logic for revert, status management, notification and so on, ensuring consistency
would be a huge hassle and pain if we don’t spawn here.
Though returning Option
, it’s always Some
, to simplify the handling logic
pub async fn get_ddl_progress(&self) -> MetaResult<Vec<DdlProgress>>
async fn create_database( &self, database: Database, ) -> MetaResult<NotificationVersion>
pub async fn alter_parallelism( &self, table_id: u32, parallelism: PbTableParallelism, deferred: bool, ) -> MetaResult<()>
async fn drop_database( &self, database_id: DatabaseId, ) -> MetaResult<NotificationVersion>
async fn create_schema(&self, schema: Schema) -> MetaResult<NotificationVersion>
async fn drop_schema( &self, schema_id: SchemaId, ) -> MetaResult<NotificationVersion>
sourceasync fn create_source_without_streaming_job(
&self,
source: Source,
) -> MetaResult<NotificationVersion>
async fn create_source_without_streaming_job( &self, source: Source, ) -> MetaResult<NotificationVersion>
Shared source is handled in Self::create_streaming_job
async fn drop_source( &self, source_id: SourceId, drop_mode: DropMode, ) -> MetaResult<NotificationVersion>
sourceasync fn alter_source(&self, source: Source) -> MetaResult<NotificationVersion>
async fn alter_source(&self, source: Source) -> MetaResult<NotificationVersion>
This replaces the source in the catalog.
Note: StreamSourceInfo
in downstream MVs’ SourceExecutor
s are not updated.
async fn create_function( &self, function: Function, ) -> MetaResult<NotificationVersion>
async fn drop_function( &self, function_id: FunctionId, ) -> MetaResult<NotificationVersion>
async fn create_view(&self, view: View) -> MetaResult<NotificationVersion>
async fn drop_view( &self, view_id: ViewId, drop_mode: DropMode, ) -> MetaResult<NotificationVersion>
async fn create_connection( &self, connection: Connection, ) -> MetaResult<NotificationVersion>
async fn drop_connection( &self, connection_id: ConnectionId, ) -> MetaResult<NotificationVersion>
async fn create_secret(&self, secret: Secret) -> MetaResult<NotificationVersion>
async fn drop_secret( &self, secret_id: SecretId, ) -> MetaResult<NotificationVersion>
async fn create_subscription( &self, subscription: Subscription, ) -> MetaResult<NotificationVersion>
async fn drop_subscription( &self, subscription_id: SubscriptionId, drop_mode: DropMode, ) -> MetaResult<NotificationVersion>
sourcepub(crate) async fn validate_cdc_table(
table: &Table,
table_fragments: &TableFragments,
) -> MetaResult<()>
pub(crate) async fn validate_cdc_table( table: &Table, table_fragments: &TableFragments, ) -> MetaResult<()>
Validates the connect properties in the cdc_table_desc
stored in the StreamCdcScan
node
pub(crate) async fn inject_replace_table_job_for_table_sink( &self, tmp_id: u32, mgr: &MetadataManager, stream_ctx: StreamContext, sink: Option<&Sink>, creating_sink_table_fragments: Option<&TableFragments>, dropping_sink_id: Option<SinkId>, streaming_job: &StreamingJob, fragment_graph: StreamFragmentGraph, ) -> MetaResult<(ReplaceTableContext, TableFragments)>
pub(crate) fn inject_replace_table_plan_for_sink( sink_id: Option<u32>, sink_fragment: &PbFragment, table: &Table, replace_table_ctx: &mut ReplaceTableContext, table_fragments: &mut TableFragments, target_fragment_id: FragmentId, unique_identity: Option<&str>, )
sourcepub async fn create_streaming_job(
&self,
streaming_job: StreamingJob,
fragment_graph: StreamFragmentGraphProto,
affected_table_replace_info: Option<ReplaceTableInfo>,
dependencies: HashSet<ObjectId>,
) -> MetaResult<NotificationVersion>
pub async fn create_streaming_job( &self, streaming_job: StreamingJob, fragment_graph: StreamFragmentGraphProto, affected_table_replace_info: Option<ReplaceTableInfo>, dependencies: HashSet<ObjectId>, ) -> MetaResult<NotificationVersion>
For CreateType::Foreground
, the function will only return after backfilling finishes
(crate::manager::MetadataManager::wait_streaming_job_finished
).
async fn create_streaming_job_inner( &self, ctx: StreamContext, streaming_job: StreamingJob, fragment_graph: StreamFragmentGraphProto, affected_table_replace_info: Option<ReplaceTableInfo>, ) -> MetaResult<NotificationVersion>
pub async fn drop_object( &self, object_type: ObjectType, object_id: ObjectId, drop_mode: DropMode, target_replace_info: Option<ReplaceTableInfo>, ) -> MetaResult<NotificationVersion>
sourcepub async fn replace_table(
&self,
streaming_job: StreamingJob,
fragment_graph: StreamFragmentGraphProto,
table_col_index_mapping: Option<ColIndexMapping>,
) -> MetaResult<NotificationVersion>
pub async fn replace_table( &self, streaming_job: StreamingJob, fragment_graph: StreamFragmentGraphProto, table_col_index_mapping: Option<ColIndexMapping>, ) -> MetaResult<NotificationVersion>
This is used for ALTER TABLE ADD/DROP COLUMN
.
async fn drop_streaming_job( &self, job_id: StreamingJobId, drop_mode: DropMode, target_replace_info: Option<ReplaceTableInfo>, ) -> MetaResult<NotificationVersion>
sourcefn resolve_stream_parallelism(
&self,
specified: Option<NonZeroUsize>,
max: NonZeroUsize,
cluster_info: &StreamingClusterInfo,
) -> MetaResult<NonZeroUsize>
fn resolve_stream_parallelism( &self, specified: Option<NonZeroUsize>, max: NonZeroUsize, cluster_info: &StreamingClusterInfo, ) -> MetaResult<NonZeroUsize>
Resolve the parallelism of the stream job based on the given information.
Returns error if user specifies a parallelism that cannot be satisfied.
sourcepub(crate) async fn build_stream_job(
&self,
stream_ctx: StreamContext,
stream_job: StreamingJob,
fragment_graph: StreamFragmentGraph,
affected_table_replace_info: Option<(StreamingJob, StreamFragmentGraph)>,
) -> MetaResult<(CreateStreamingJobContext, TableFragments)>
pub(crate) async fn build_stream_job( &self, stream_ctx: StreamContext, stream_job: StreamingJob, fragment_graph: StreamFragmentGraph, affected_table_replace_info: Option<(StreamingJob, StreamFragmentGraph)>, ) -> MetaResult<(CreateStreamingJobContext, TableFragments)>
Builds the actor graph:
- Add the upstream fragments to the fragment graph
- Schedule the fragments based on their distribution
- Expand each fragment into one or several actors
sourcepub(crate) async fn build_replace_table(
&self,
stream_ctx: StreamContext,
stream_job: &StreamingJob,
fragment_graph: StreamFragmentGraph,
table_col_index_mapping: Option<ColIndexMapping>,
tmp_table_id: TableId,
) -> MetaResult<(ReplaceTableContext, TableFragments)>
pub(crate) async fn build_replace_table( &self, stream_ctx: StreamContext, stream_job: &StreamingJob, fragment_graph: StreamFragmentGraph, table_col_index_mapping: Option<ColIndexMapping>, tmp_table_id: TableId, ) -> MetaResult<(ReplaceTableContext, TableFragments)>
build_replace_table
builds a table replacement and returns the context and new table
fragments.
Note that we use a dummy ID for the new table fragments and replace it with the real one after replacement is finished.
async fn alter_name( &self, relation: Object, new_name: &str, ) -> MetaResult<NotificationVersion>
async fn alter_swap_rename( &self, object: Object, ) -> MetaResult<NotificationVersion>
async fn alter_owner( &self, object: Object, owner_id: UserId, ) -> MetaResult<NotificationVersion>
async fn alter_set_schema( &self, object: Object, new_schema_id: SchemaId, ) -> MetaResult<NotificationVersion>
pub async fn wait(&self) -> MetaResult<()>
async fn comment_on(&self, comment: Comment) -> MetaResult<NotificationVersion>
Trait Implementations§
source§impl Clone for DdlController
impl Clone for DdlController
source§fn clone(&self) -> DdlController
fn clone(&self) -> DdlController
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for DdlController
impl !RefUnwindSafe for DdlController
impl Send for DdlController
impl Sync for DdlController
impl Unpin for DdlController
impl !UnwindSafe for DdlController
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> 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.