Skip to content

Commit

Permalink
Prevent out-of-region members from appearing eligible (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
davissp14 authored Oct 7, 2022
1 parent ab96afc commit df0372b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .flyctl/cmd/pg-failover/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
// Discover keepers that are eligible for promotion.
eligibleCount := 0
for _, keeper := range data.Keepers {
if keeper.Status.Healthy && keeper.Status.CanBeMaster != nil && keeper.UID != currentMasterUID {
if keeper.Status.Healthy && keeper.Status.CanBeMaster && keeper.UID != currentMasterUID {
fmt.Printf("Keeper %s is eligible! Master is %s\n", keeper.UID, currentMasterUID)
eligibleCount++
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func handleFailoverTrigger(w http.ResponseWriter, r *http.Request) {
// Discover keepers that are eligible for promotion.
eligibleCount := 0
for _, keeper := range data.Keepers {
if keeper.Status.Healthy && keeper.Status.CanBeMaster != nil && keeper.UID != currentMasterUID {
if keeper.Status.Healthy && keeper.Status.CanBeMaster && keeper.UID != currentMasterUID {
fmt.Printf("Keeper %s is eligible! Master is %s\n", keeper.UID, currentMasterUID)
eligibleCount++
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/flypg/stolon/clusterdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ type KeeperStatus struct {

ForceFail bool `json:"forceFail,omitempty"`

CanBeMaster *bool `json:"canBeMaster,omitempty"`
CanBeMaster bool `json:"canBeMaster,omitempty"`
CanBeSynchronousReplica *bool `json:"canBeSynchronousReplica,omitempty"`
}

Expand Down

0 comments on commit df0372b

Please sign in to comment.