Skip to content

Commit d5c7fdd

Browse files
committed
Move slot creation to before bootstrap
1 parent 4f5a9bf commit d5c7fdd

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/bin/stream.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,13 @@ async fn run_session(
754754
// None = slotless.
755755
let source_slot: Option<String> = ch_config.as_ref().and_then(|c| c.source_slot.clone());
756756
let shadow_start = resolve_shadow_start(args)?;
757+
// Slot before bootstrap
758+
if let Some(slot) = source_slot.as_deref() {
759+
feed.ensure_physical_slot(slot)
760+
.await
761+
.with_context(|| format!("ensure physical replication slot {slot}"))?;
762+
tracing::info!(target: "walshadow", slot, "physical replication slot ready");
763+
}
757764
let bootstrap_end_lsn: Option<u64> = if matches!(shadow_start, ShadowStart::Bootstrap(_)) {
758765
Some(
759766
run_bootstrap(&cfg, &mut feed, args, ch_config.clone())
@@ -991,14 +998,6 @@ async fn run_session(
991998
"shadow connected",
992999
);
9931000

994-
// Create the configured slot before preflight, which requires it to exist.
995-
if let Some(slot) = source_slot.as_deref() {
996-
feed.ensure_physical_slot(slot)
997-
.await
998-
.with_context(|| format!("ensure physical replication slot {slot}"))?;
999-
tracing::info!(target: "walshadow", slot, "physical replication slot ready");
1000-
}
1001-
10021001
// Pre-flight validators run after both source + shadow SQL clients
10031002
// are up so every check has its connection.
10041003
if !args.skip_preflight {

0 commit comments

Comments
 (0)