Bug fix
This commit is contained in:
		
							parent
							
								
									0d3eeedb39
								
							
						
					
					
						commit
						8470bf2d30
					
				|  | @ -349,7 +349,13 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration() error { | ||||||
| 	optionsToSet := make(map[string]string) | 	optionsToSet := make(map[string]string) | ||||||
| 	pgOptions := c.Spec.Parameters | 	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 { | 	for k, v := range pgOptions { | ||||||
| 		if isBootstrapOnlyParameter(k) { | 		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 | 		return nil | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -371,10 +377,12 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration() error { | ||||||
| 	// carries the request to change configuration through
 | 	// carries the request to change configuration through
 | ||||||
| 	for _, pod := range pods { | 	for _, pod := range pods { | ||||||
| 		podName := util.NameFromMeta(pod.ObjectMeta) | 		podName := util.NameFromMeta(pod.ObjectMeta) | ||||||
| 		c.logger.Debugf("calling Patroni API on a pod %s to promote the Standby", | 		if len(standbyOptions) > 0 { | ||||||
| 			podName) | 			c.logger.Debugf("calling Patroni API on a pod %s to edit the Standby", | ||||||
| 		if err = c.patroni.EditStandby(&pod, standbyOptions); err != nil { | 				podName) | ||||||
| 			c.logger.Warningf("could not patch postgres for standby with a pod %s: %v", podName, err) | 			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", | 		c.logger.Debugf("calling Patroni API on a pod %s to set the following Postgres options: %v", | ||||||
| 			podName, optionsToSet) | 			podName, optionsToSet) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue