De acordo com o post Six For Two , você pode apenas ser capaz de criar um arquivo e então seguir em frente com a configuração de replicação, mas essencialmente é um bug do PostgresSQL onde ele precisa deste arquivo, mesmo que não seja aplicável ou seja deletado por operação.
When PostgreSQL promotes a new primary server, it creates a marker of the timeline split in the form of a small text file placed in the WAL file directory. This file makes it possible to achieve Point-In-Time-Recovery under some rather complex failover and fail-back scenarios.
So it seems that you will have to recreate the file. You can find a very nice summary of the .history file on the Postgres wiki. Since the info is in .pdf, though, it tends to be harder to index, so you may have trouble locating the doc if you don't already know it's there.
But we're never going to go back to that timeline, because it's before our upgrade. All we'd need to recreate a lost file is a good enough number. And you can get one by running:
# SELECT pg_current_xlog_location(); pg_current_xlog_location -------------------------- 1/38F70328 (1 row)
Mock up a .history file in your WAL directory with these values, et voila. The replica will immediately be able to start.
Crie o arquivo com esses resultados (acima), mas com o nome esperado por erro.
Mais recursos
System Administration Functions
Name:
pg_current_xlog_location()
Return Type: text
Description: Get current transaction log write location
pg_current_xlog_location
displays the current transaction log write location in the same format used by the above functions. Similarly, pg_current_xlog_insert_location displays the current transaction log insertion point. The insertion point is the "logical" end of the transaction log at any instant, while the write location is the end of what has actually been written out from the server's internal buffers. The write location is the end of what can be examined from outside the server, and is usually what you want if you are interested in archiving partially-complete transaction log files. The insertion point is made available primarily for server debugging purposes. These are both read-only operations and do not require superuser permissions.You can use
pg_xlogfile_name_offset
to extract the corresponding transaction log file name and byte offset from the results of any of the above functions.Similarly,
pg_xlogfile_name
extracts just the transaction log file name. When the given transaction log location is exactly at a transaction log file boundary, both these functions return the name of the preceding transaction log file. This is usually the desired behavior for managing transaction log archiving behavior, since the preceding file is the last one that currently needs to be archived.