Skip to content

Commit

Permalink
Add check for rds replication (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj authored Jan 21, 2024
1 parent b47b56a commit 98581a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion flow/connectors/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,12 @@ func (c *PostgresConnector) CheckReplicationPermissions(username string) error {
}

if !replicationRes {
return fmt.Errorf("postgres user does not have replication role")
// RDS case: check pg_settings for rds.logical_replication
var setting string
err := c.pool.QueryRow(c.ctx, "SELECT setting FROM pg_settings WHERE name = 'rds.logical_replication';").Scan(&setting)
if err != nil || setting != "on" {
return fmt.Errorf("postgres user does not have replication role")
}
}

// check wal_level
Expand Down
8 changes: 7 additions & 1 deletion ui/app/mirrors/edit/[mirrorId]/cdcDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ type props = {
createdAt?: Date;
};
function CdcDetails({ syncs, createdAt, mirrorConfig }: props) {
let lastSyncedAt = moment(syncs[0]?.endTime).fromNow();
let lastSyncedAt = moment(
syncs.length > 1
? syncs[1]?.endTime
: syncs.length
? syncs[0]?.startTime
: new Date()
).fromNow();
let rowsSynced = syncs.reduce((acc, sync) => {
if (sync.endTime !== null) {
return acc + sync.numRows;
Expand Down

0 comments on commit 98581a4

Please sign in to comment.