minor changes
This commit is contained in:
parent
d64b988491
commit
916b6fe1d7
|
|
@ -404,7 +404,7 @@ func (c *Cluster) syncStatefulSet() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// empty config probably means cluster is not fully initialized yet, e.g. restoring from backup
|
// empty config probably means cluster is not fully initialized yet, e.g. restoring from backup
|
||||||
// to not attempt a restart in such situation
|
// do not attempt a restart
|
||||||
if !reflect.DeepEqual(patroniConfig, emptyPatroniConfig) || len(pgParameters) > 0 {
|
if !reflect.DeepEqual(patroniConfig, emptyPatroniConfig) || len(pgParameters) > 0 {
|
||||||
instanceRestartRequired, err = c.checkAndSetGlobalPostgreSQLConfiguration(&pod, patroniConfig, pgParameters)
|
instanceRestartRequired, err = c.checkAndSetGlobalPostgreSQLConfiguration(&pod, patroniConfig, pgParameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ func (p *Patroni) GetConfig(server *v1.Pod) (acidv1.Patroni, map[string]string,
|
||||||
return patroniConfig, pgParameters, err
|
return patroniConfig, pgParameters, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restart method restarts instance via Patroni POST API call.
|
// Restart method restarts instance via Patroni POST API call.
|
||||||
func (p *Patroni) Restart(server *v1.Pod) error {
|
func (p *Patroni) Restart(server *v1.Pod) error {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
err := json.NewEncoder(buf).Encode(map[string]interface{}{"restart_pending": true})
|
err := json.NewEncoder(buf).Encode(map[string]interface{}{"restart_pending": true})
|
||||||
|
|
@ -238,8 +238,12 @@ func (p *Patroni) Restart(server *v1.Pod) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
memberData, _ := p.GetMemberData(server)
|
memberData, err := p.GetMemberData(server)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// do restart only when it is pending
|
||||||
if !memberData.PendingRestart {
|
if !memberData.PendingRestart {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue