Skip to content

Commit

Permalink
missed a few
Browse files Browse the repository at this point in the history
  • Loading branch information
benwaffle committed Aug 6, 2024
1 parent f2a0e13 commit 8db49fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/flypg/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,10 @@ func (n *Node) PostInit(ctx context.Context) error {
}

// This should never happen
if primary != n.PrivateIP {
if primary != n.RepMgr.machineIdToDNS(n.MachineID) {
return fmt.Errorf("resolved primary '%s' does not match ourself '%s'. this should not happen",
primary,
n.PrivateIP,
n.RepMgr.machineIdToDNS(n.MachineID),
)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/flypg/repmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (r *RepMgr) regenReplicationConf(ctx context.Context) error {
// TODO: do we need -c?
if _, err := utils.RunCmd(ctx, "postgres",
"repmgr", "--replication-conf-only",
"-h", r.PrivateIP,
"-h", "",
"-p", fmt.Sprint(r.Port),
"-d", r.DatabaseName,
"-U", r.Credentials.Username,
Expand Down
5 changes: 3 additions & 2 deletions internal/flypg/zombie.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type DNASample struct {

func TakeDNASample(ctx context.Context, node *Node, standbys []Member) (*DNASample, error) {
sample := &DNASample{
hostname: node.PrivateIP,
hostname: node.RepMgr.machineIdToDNS(node.MachineID),
totalMembers: len(standbys) + 1,
totalActive: 1,
totalInactive: 0,
Expand Down Expand Up @@ -117,7 +117,8 @@ func TakeDNASample(ctx context.Context, node *Node, standbys []Member) (*DNASamp
sample.totalActive++

// Record conflict when primary doesn't match.
if primary.Hostname != node.MachineID && primary.Hostname != node.PrivateIP {
// We're checking PrivateIP here for backwards compatibility
if primary.Hostname != node.RepMgr.machineIdToDNS(node.MachineID) && primary.Hostname != node.PrivateIP {
sample.totalConflicts++
sample.conflictMap[primary.Hostname]++
}
Expand Down

0 comments on commit 8db49fb

Please sign in to comment.