Skip to content

archiver : ERROR: recovery is in progress HINT: pg_walfile_name() cannot be executed during recovery. #384

@Krysztophe

Description

@Krysztophe

After a switchover, on the secondary (formerly primary), the archiver service fails with

ERROR:  recovery is in progress
HINT:  pg_walfile_name() cannot be executed during recovery.

The service was fine on the secondary before the switchover.

I'm surprised to see this only now.

Cause: pg_stat_archiver is not as empty as I see usually, it contains WAL names, eg:

select pg_is_in_recovery() , current_setting('archive_mode') as archive_mode, * from  pg_stat_archiver \gx
-[ RECORD 1 ]------+------------------------------
pg_is_in_recovery  | t
archive_mode       | on
archived_count     | 860475
last_archived_wal  | 0000000100000DA200000037
last_archived_time | 2025-09-08 14:02:02.458681+02
failed_count       | 1227
last_failed_wal    | 0000000100000D9C000000EC
last_failed_time   | 2025-09-08 11:46:34.035206+02
stats_reset        | 2025-07-16 12:18:51.395272+02

Fix : Add CASE WHEN pg_is_in_recovery() THEN null ELSE extract ... there ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions