Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for rds replication #1118

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading