Skip to content

Commit 8db49fb

Browse files
author
Ben Iofel
committed
missed a few
1 parent f2a0e13 commit 8db49fb

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

internal/flypg/node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ func (n *Node) PostInit(ctx context.Context) error {
297297
}
298298

299299
// This should never happen
300-
if primary != n.PrivateIP {
300+
if primary != n.RepMgr.machineIdToDNS(n.MachineID) {
301301
return fmt.Errorf("resolved primary '%s' does not match ourself '%s'. this should not happen",
302302
primary,
303-
n.PrivateIP,
303+
n.RepMgr.machineIdToDNS(n.MachineID),
304304
)
305305
}
306306

internal/flypg/repmgr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (r *RepMgr) regenReplicationConf(ctx context.Context) error {
329329
// TODO: do we need -c?
330330
if _, err := utils.RunCmd(ctx, "postgres",
331331
"repmgr", "--replication-conf-only",
332-
"-h", r.PrivateIP,
332+
"-h", "",
333333
"-p", fmt.Sprint(r.Port),
334334
"-d", r.DatabaseName,
335335
"-U", r.Credentials.Username,

internal/flypg/zombie.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type DNASample struct {
8484

8585
func TakeDNASample(ctx context.Context, node *Node, standbys []Member) (*DNASample, error) {
8686
sample := &DNASample{
87-
hostname: node.PrivateIP,
87+
hostname: node.RepMgr.machineIdToDNS(node.MachineID),
8888
totalMembers: len(standbys) + 1,
8989
totalActive: 1,
9090
totalInactive: 0,
@@ -117,7 +117,8 @@ func TakeDNASample(ctx context.Context, node *Node, standbys []Member) (*DNASamp
117117
sample.totalActive++
118118

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

0 commit comments

Comments
 (0)