mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-04 17:33:12 +02:00
collect new and updated slots to patch patroni
This commit is contained in:
+9
-3
@@ -405,7 +405,7 @@ func (c *Cluster) syncStatefulSet() error {
|
||||
|
||||
// empty config probably means cluster is not fully initialized yet, e.g. restoring from backup
|
||||
// to not attempt a restart in such situation
|
||||
if reflect.DeepEqual(patroniConfig, emptyPatroniConfig) || len(pgParameters) > 0 {
|
||||
if !reflect.DeepEqual(patroniConfig, emptyPatroniConfig) || len(pgParameters) > 0 {
|
||||
instanceRestartRequired, err = c.checkAndSetGlobalPostgreSQLConfiguration(&pod, patroniConfig, pgParameters)
|
||||
if err != nil {
|
||||
c.logger.Warningf("could not set PostgreSQL configuration options for pod %s: %v", podName, err)
|
||||
@@ -542,11 +542,17 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration(pod *v1.Pod, patroniC
|
||||
|
||||
// only check if specified slots exist in config and if they differ
|
||||
for slotName, desiredSlot := range desiredPatroniConfig.Slots {
|
||||
desiredSlots := make(map[string]map[string]string)
|
||||
if effectiveSlot, exists := patroniConfig.Slots[slotName]; exists {
|
||||
if !reflect.DeepEqual(desiredSlot, effectiveSlot) {
|
||||
configToSet["slots"] = desiredPatroniConfig.Slots
|
||||
break
|
||||
desiredSlots[slotName] = desiredSlot
|
||||
}
|
||||
} else {
|
||||
desiredSlots[slotName] = desiredSlot
|
||||
}
|
||||
|
||||
if len(desiredSlots) > 0 {
|
||||
configToSet["slots"] = desiredSlots
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user