Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
Signed-off-by: xxchan <xxchan22f@gmail.com>
  • Loading branch information
xxchan committed Jan 14, 2025
1 parent bd5537a commit 30f18d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
12 changes: 3 additions & 9 deletions src/meta/service/src/cloud_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,9 @@ impl CloudService for CloudServiceImpl {
};
let props = props.unwrap();

async fn new_enumerator(
props: ConnectorProperties,
) -> ConnectorResult<Box<dyn AnySplitEnumerator>> {
props
.create_split_enumerator(SourceEnumeratorContext::dummy().into())
.await
}

let enumerator = new_enumerator(props).await;
let enumerator = props
.create_split_enumerator(SourceEnumeratorContext::dummy().into())
.await;
if let Err(e) = enumerator {
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaInvalidProperties,
Expand Down
13 changes: 4 additions & 9 deletions src/meta/src/rpc/ddl_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,6 @@ impl DdlController {
)
})?;

async fn new_enumerator_for_validate(
source_props: ConnectorProperties,
) -> Result<Box<dyn AnySplitEnumerator>, ConnectorError> {
source_props
.create_split_enumerator(SourceEnumeratorContext::dummy().into())
.await
}

for actor in &stream_scan_fragment.actors {
if let Some(NodeBody::StreamCdcScan(ref stream_cdc_scan)) =
actor.nodes.as_ref().unwrap().node_body
Expand All @@ -671,7 +663,10 @@ impl DdlController {
let mut props = ConnectorProperties::extract(options_with_secret, true)?;
props.init_from_pb_cdc_table_desc(cdc_table_desc);

let _enumerator = new_enumerator_for_validate(props).await?;
// try creating a split enumerator to validate
let _enumerator = source_props
.create_split_enumerator(SourceEnumeratorContext::dummy().into())
.await?;
tracing::debug!(?table.id, "validate cdc table success");
}
}
Expand Down

0 comments on commit 30f18d5

Please sign in to comment.