While managing your PostgreSQL databases, especially if you deal with the WAL archive or let Barman handle it, you might encounter some files with .partial
extension. Let's see what their purpose is.
Partial WAL segments (files containing WAL information with .partial
extension) can be found in PostgreSQL in two use cases only:
- If you use
pg_receivewal
for WAL streaming (Barman does that) - If you perform a promotion of a standby in the middle of a WAL segment recovery, and you have got
archiver
set to on.
pg_receivewal (formerly known as pg_receivexlog
), is a client application part of PostgreSQL designed to stream write ahead logs from a streaming protocol server (usually a master, or a standby in case of cascading replication). It is used by Barman to implement WAL streaming and, in synchronous commit contexts, achieve zero data loss, that is Recovery Point Objective (RPO) = 0.
When streaming, pg_receivewal
stores the current WAL file being received with a .partial
extension. When the WAL file is closed by the source server, the file is renamed without the suffix, and a new .partial
file is created for the subsequent WAL.
Version 2.10 of Barman introduces transparent support for recovery of .partial
files when --get-wal
option is used.
Consider this scenario. You have a standby that is recovering from a primary server. Due to failover (or supposed failover), you promote the standby in the middle of a WAL segment and switch timeline.
What shall we do with that file? Shall we archive it, or not? And if we do, how do we make sure it won't collide with the one that has been archived by the former master?
For this reason, the compromise that PostgreSQL developers found and introduced in PostgreSQL 9.5 was to let the standby archive the last segment renaming it with a .partial
suffix, while regularly storing the current file with same sequence number but higher timeline in the archive.
Such a partial file will never be used by recovery procedures (which will use the higher timeline having followed the .history
file), but it can be helpful for debug and investigation purposes.