This commit is contained in:
Rafia Sabih 2019-06-24 16:49:30 +02:00
parent 0d3eeedb39
commit 8470bf2d30
1 changed files with 14 additions and 6 deletions

View File

@ -349,7 +349,13 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration() error {
optionsToSet := make(map[string]string)
pgOptions := c.Spec.Parameters
standbyOptions := c.Spec.StandbyCluster.StandbyOptions
standbyOptions := make(map[string]string)
if c.Spec.StandbyCluster != nil {
for k, v := range c.Spec.StandbyCluster.StandbyOptions {
standbyOptions[k] = v
}
}
for k, v := range pgOptions {
if isBootstrapOnlyParameter(k) {
@ -357,7 +363,7 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration() error {
}
}
if len(optionsToSet) == 0 {
if len(optionsToSet) == 0 && len(standbyOptions) == 0 {
return nil
}
@ -371,11 +377,13 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration() error {
// carries the request to change configuration through
for _, pod := range pods {
podName := util.NameFromMeta(pod.ObjectMeta)
c.logger.Debugf("calling Patroni API on a pod %s to promote the Standby",
if len(standbyOptions) > 0 {
c.logger.Debugf("calling Patroni API on a pod %s to edit the Standby",
podName)
if err = c.patroni.EditStandby(&pod, standbyOptions); err != nil {
c.logger.Warningf("could not patch postgres for standby with a pod %s: %v", podName, err)
}
}
c.logger.Debugf("calling Patroni API on a pod %s to set the following Postgres options: %v",
podName, optionsToSet)
if err = c.patroni.SetPostgresParameters(&pod, optionsToSet); err == nil {