Skip to content

Commit 273e30c

Browse files
committed
Additional nil check
1 parent dd2b79c commit 273e30c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

controllers/postgres_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,11 @@ func (r *PostgresReconciler) checkAndUpdatePatroniReplicationConfig(log logr.Log
10771077
} else {
10781078
synchronousStandbyApplicationName = pointer.String(s.ToPeripheralResourceName())
10791079
}
1080-
if resp.SynchronousNodesAdditional == nil || *resp.SynchronousNodesAdditional != *synchronousStandbyApplicationName {
1080+
// compare the actual value with the expected value
1081+
if synchronousStandbyApplicationName == nil {
1082+
log.V(debugLogLevel).Info("could not fetch synchronous_nodes_additional, disabling sync replication and requeing", "response", resp)
1083+
return requeueAfterReconcile, r.httpPatchPatroni(log, ctx, instance, leaderIP, nil)
1084+
} else if resp.SynchronousNodesAdditional == nil || *resp.SynchronousNodesAdditional != *synchronousStandbyApplicationName {
10811085
log.V(debugLogLevel).Info("synchronous_nodes_additional mismatch, updating and requeing", "response", resp)
10821086
return requeueAfterReconcile, r.httpPatchPatroni(log, ctx, instance, leaderIP, synchronousStandbyApplicationName)
10831087
}

0 commit comments

Comments
 (0)