MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / ensureWalArchiveIsWorking

Function ensureWalArchiveIsWorking

pkg/management/postgres/wal.go:43–55  ·  view source on GitHub ↗

ensureWalArchiveIsWorking behaves slightly differently when executed on primary or a standby. On primary, it could run even before the first WAL has completed. For this reason it could require a WAL switch, to quicken the check. On standby, the mere existence of the standby guarantees that a WAL fil

(instance *Instance)

Source from the content-addressed store, hash-verified

41// by the pg_basebackup used to prime the standby data directory, so we check only if the WAL
42// archive process is not failing.
43func ensureWalArchiveIsWorking(instance *Instance) error {
44 isPrimary, err := instance.IsPrimary()
45 if err != nil {
46 return err
47 }
48
49 if isPrimary {
50 return newWalArchiveBootstrapperForPrimary().ensureFirstWalArchived(instance, retryUntilWalArchiveWorking)
51 }
52
53 return newWalArchiveAnalyzerForReplicaInstance(instance.GetPrimaryConnInfo()).
54 mustHaveFirstWalArchivedWithBackoff(retryUntilWalArchiveWorking)
55}
56
57// walArchiveAnalyzer represents an object that can check for the status of
58// WAL archiving, in primary or replicas

Callers 1

StartMethod · 0.85

Tested by

no test coverage detected