Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clone_with_wale on pg13+ when recovery_time in future #580

Merged
merged 2 commits into from
May 7, 2021

Conversation

CyberDem0n
Copy link
Contributor

PostgreSQL 13 changed its behavior when the recovery target is unreachable. While old versions were finishing the recovery and
promoting Postgres, starting from 13 Postgres complains "recovery ended before configured recovery target was reached" in logs and exits. As a result, the clone completely fails.

In order to retain the same behavior as with old versions, the maybe_pg_upgrade.py will always start point-in-time recovery (even if there is no major upgrade required).
If it failed, for PostgreSQL 13+ it will check a few last log lines and if they contain the error about the recovery target not reached,
it will reset all recovery targets and start the postgres up one more time. The next failure is fatal.

PostgreSQL 13 changed its behavior when the recovery target is
unreachable. While old versions were finishing the recovery and
promoting Postgres, starting from 13 Postgres complains
"recovery ended before configured recovery target was reached" in
logs and exits. As a result, the clone completely fails.

In order to retain the same behavior as with old versions, the
`maybe_pg_upgrade.py` will always start point-in-time recovery
(even if there is no major upgrade required).
If it failed, for PostgreSQL 13+ it will check a few last log lines
and if they contain the error about the recovery target not reached,
it will reset all recovery targets and start the postgres up
one more time. The next failure is fatal.
@sdudoladov
Copy link
Member

👍

@sdudoladov
Copy link
Member

👍

1 similar comment
@CyberDem0n
Copy link
Contributor Author

👍

@CyberDem0n CyberDem0n merged commit 8cb6375 into master May 7, 2021
@CyberDem0n CyberDem0n deleted the feature/clone-13-unreachable-target branch May 7, 2021 12:38
@OlleLarsson
Copy link
Contributor

OlleLarsson commented Jun 10, 2021

I haven't run the version of spilo where this pr is included but I was just wondering if this works even if I have disabled csv logging, aka set the following in the postgres configuration

log_destination: "stderr"
logging_collector: "off"

?

@CyberDem0n
Copy link
Contributor Author

if this works even if I have disabled csv logging

No, it won't work. Unfortunately, there is no universal solution to this problem. If you don't rely on CSV logs I can only suggest not set recovery target in the future.

@OlleLarsson
Copy link
Contributor

Thanks for the reply, I'll make sure to make a note of this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants