This commit is contained in:
Sergey Dudoladov 2020-04-20 14:05:33 +02:00
parent 3b382f6f34
commit 0c5dfeab06
2 changed files with 4 additions and 4 deletions

View File

@ -305,7 +305,7 @@ func (c *Cluster) isSafeToRecreatePods(pods *v1.PodList) bool {
*/ */
for _, pod := range pods.Items { for _, pod := range pods.Items {
state, err := c.patroni.GetNodeState(&pod) state, err := c.patroni.GetPatroniMemberState(&pod)
if err != nil || state == "creating replica" { if err != nil || state == "creating replica" {
c.logger.Warningf("cannot re-create replica %s: it is currently being initialized", pod.Name) c.logger.Warningf("cannot re-create replica %s: it is currently being initialized", pod.Name)
return false return false

View File

@ -26,7 +26,7 @@ const (
type Interface interface { type Interface interface {
Switchover(master *v1.Pod, candidate string) error Switchover(master *v1.Pod, candidate string) error
SetPostgresParameters(server *v1.Pod, options map[string]string) error SetPostgresParameters(server *v1.Pod, options map[string]string) error
GetNodeState(pod *v1.Pod) (string, error) GetPatroniMemberState(pod *v1.Pod) (string, error)
} }
// Patroni API client // Patroni API client
@ -126,8 +126,8 @@ func (p *Patroni) SetPostgresParameters(server *v1.Pod, parameters map[string]st
return p.httpPostOrPatch(http.MethodPatch, apiURLString+configPath, buf) return p.httpPostOrPatch(http.MethodPatch, apiURLString+configPath, buf)
} }
//GetNodeState returns node state reported by Patroni API call. //GetPatroniMemberState returns node state reported by Patroni API call.
func (p *Patroni) GetNodeState(server *v1.Pod) (string, error) { func (p *Patroni) GetPatroniMemberState(server *v1.Pod) (string, error) {
apiURLString, err := apiURL(server) apiURLString, err := apiURL(server)
if err != nil { if err != nil {