Skip to content

Commit

Permalink
Skip empty sources, fill ID with connector, generate random server ID…
Browse files Browse the repository at this point in the history
… for MySQL CDC sources
  • Loading branch information
shanicky committed Nov 14, 2023
1 parent 9eb0db1 commit 2e447d8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/meta/service/src/ddl_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,15 +868,18 @@ fn fill_table_stream_graph_info(
for fragment in fragment_graph.fragments.values_mut() {
visit_fragment(fragment, |node_body| {
if let NodeBody::Source(source_node) = node_body {
if source_node.source_inner.is_none() {
// skip empty source for dml node
return;
}

// If we're creating a table with connector, we should additionally fill its ID first.
if let Some(&mut (ref mut source, source_id)) = source_info.as_mut() {
source.id = source_id;
let mut source_count = 0;

if let Some(source_inner) = source_node.source_inner.as_mut() {
source_inner.source_id = source_id;
source_count += 1;
}
source_node.source_inner.as_mut().unwrap().source_id = source_id;
source_count += 1;

// Generate a random server id for mysql cdc source if needed
// `server.id` (in the range from 1 to 2^32 - 1). This value MUST be unique across whole replication
Expand Down

0 comments on commit 2e447d8

Please sign in to comment.