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)
| 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. |
| 43 | func 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 |
no test coverage detected