Skip to content

Conversation

@NJrslv
Copy link
Contributor

@NJrslv NJrslv commented Oct 28, 2025

What

Read restore_command_hint from postgresql.conf during promotion when restore_command is missing from recovery.conf.

Why

pg_basebackup/pg_rewind don't write restore_command during recovery.conf generation, so recovery.conf should always be missing restore_command.

For what

Solves timeline collisions. During promotion, a newer timeline might exist in the archive. If the promoting segment doesn't know about it, it could pick locally the same timeline ID as in the archive. Later when pushing to the archive, this causes errors that the timeline ID already exists.

Tests

Since the issue isn't solved in pg_basebackup or pg_rewind, the choice of recovery method before promotion doesn't matter. I put restore_command_hint in postgresql.conf for pg_rewind tests and verified execution.

I didn't reproduce the timeline collision on my demo cluster. If you think I should, please leave a comment with the reproduction suggestions (tests where to put it).

@NJrslv NJrslv force-pushed the njrslv/get_missing_restore_cmd branch from e60ec9a to bfe3961 Compare October 28, 2025 13:27
@NJrslv NJrslv requested a review from reshke October 28, 2025 13:42
@NJrslv
Copy link
Contributor Author

NJrslv commented Oct 29, 2025

Should add a test with timeline collision

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.

2 participants