]> granicus.if.org Git - postgresql/commit
Clean up temporary WAL segments after an instance crash
authorMichael Paquier <michael@paquier.xyz>
Thu, 12 Jul 2018 21:43:20 +0000 (06:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 12 Jul 2018 21:43:20 +0000 (06:43 +0900)
commit5fc1008e8a8b9e96ac75b4db5dd9ad2b99a9c8b2
tree55af2567e2d78718cd064eddd8b924bf34e8e6f9
parent5e6e2c8773dd8e3037d9195452dc5e423367e1b0
Clean up temporary WAL segments after an instance crash

Temporary WAL segments are created in pg_wal and named as xlogtemp.pid
before being renamed to the real deal when creating a new segment.  If
an instance crashes after the temporary segment is created and before
the rename is done, then the server would finish with unremovable data.

After an instance crash, scan pg_wal and remove any such segments.  With
repetitive unlucky crashes this would contribute to disk bloat and
presents risks of ENOSPC especially with max_wal_size close to the
maximum allowed.

Author: Michael Paquier
Reviewed-by: Yugo Nagata, Heikki Linnakangas
Discussion: https://postgr.es/m/20180514054955.GF1528@paquier.xyz
src/backend/access/transam/xlog.c