title: How to fix this ERROR: could not open file "pg_wal/00000003.history", or what *not* to do when PostgreSQL runs out of disk space
body: <p>If you ever run out of space in your <code>pg_wal</code> directory, and you can't grow the size of that directory or switch to standby in a case where your primary goes down as a result of the full pg_wal directory, when moving the WAL files to a different location, ensure not to move <code>pg_wal/00000003.history</code>as it is a core file when starting pg_basebackup for streaming replication. If in case you had moved the file already to a different location, consider bringing this particular one <code>pg_wal/00000003.history</code> back to the <code>pg_wal</code> directory.</p>
  <p>In a case where you had actually deleted the file then you may consider just creating another to see if will work...i have not tried it myself so you maybe the first or second to try :).</p>
  <p>I faced this issue in my production environment and resolved it by copying back <code>pg_wal/00000003.history</code> from where i had copied it to and my streaming replication could run without errors.</p>