Skip to content

Commit

Permalink
do export snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Mar 20, 2024
1 parent 966e4a5 commit bba4e9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 13 additions & 0 deletions flow/connectors/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,23 @@ func (c *PostgresConnector) createSlotAndPublication(
Err: nil,
SupportsTIDScans: ok,
}

conn.Close(ctx)
snapshotOutput, tx, err := c.ExportTxSnapshot(ctx)
if err != nil {
return fmt.Errorf("error exporting snapshot: %w", err)
}

slotDetails.SnapshotName = snapshotOutput.SnapshotName
signal.SlotCreated <- slotDetails
c.logger.Info("Waiting for clone to complete")

<-signal.CloneComplete
c.logger.Info("Clone complete")
err = c.FinishExport(tx)
if err != nil {
return fmt.Errorf("error finishing export: %w", err)
}
} else {
c.logger.Info(fmt.Sprintf("Replication slot '%s' already exists", slot))
var e error
Expand Down
2 changes: 0 additions & 2 deletions ui/app/mirrors/create/cdc/cdc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export default function CDCConfigForm({
const label = setting.label.toLowerCase();
if (
(label.includes('snapshot') && mirrorConfig.doInitialSnapshot !== true) ||
(label === 'replication slot name' &&
mirrorConfig.doInitialSnapshot === true) ||
(label.includes('staging path') &&
defaultSyncMode(mirrorConfig.destination?.type) !== 'AVRO')
) {
Expand Down

0 comments on commit bba4e9c

Please sign in to comment.