MCPcopy Index your code
hub / github.com/cloudnative-pg/cloudnative-pg / Demote

Method Demote

pkg/management/postgres/instance.go:1006–1013  ·  view source on GitHub ↗

Demote demotes an existing PostgreSQL instance

(ctx context.Context, cluster *apiv1.Cluster)

Source from the content-addressed store, hash-verified

1004
1005// Demote demotes an existing PostgreSQL instance
1006func (instance *Instance) Demote(ctx context.Context, cluster *apiv1.Cluster) error {
1007 contextLogger := log.FromContext(ctx)
1008
1009 contextLogger.Info("Demoting instance", "pgpdata", instance.PgData)
1010 slotName := cluster.GetSlotNameFromInstanceName(instance.GetPodName())
1011 _, err := UpdateReplicaConfiguration(instance.PgData, instance.GetPrimaryConnInfo(), slotName)
1012 return err
1013}
1014
1015// WaitForPrimaryAvailable waits until we can connect to the primary
1016func (instance *Instance) WaitForPrimaryAvailable(ctx context.Context) error {

Callers 3

instance_test.goFile · 0.80
RestoreSnapshotMethod · 0.80

Calls 5

GetPodNameMethod · 0.95
GetPrimaryConnInfoMethod · 0.95
InfoMethod · 0.80

Tested by

no test coverage detected