Skip to content

Conversation

@jason-lynch
Copy link
Member

Summary

It's not possible to persist recovery options outside of the bootstrap process and it's not possible to force Patroni into the bootstrap process if the pgdata directory is non-empty.

So, this commit changes the in-place restore process to temporarily move the pgdata directory to a different name. Then, it changes the bootstrap command to simply move the pgdata directory back to its original name. This lets us keep our existing restore process and makes patroni keep the recovery options.

Testing

  • Use the Reverting to an earlier backup Bruno scenario in the local-backup-and-restore directory with these modifications:
    • After creating the database, add some data to it
    • Submit the Backup database node request
      • Note the set name (e.g. 20251221-201008F) in the developer console output or look at the directory name in the repos folder
    • Delete the data from the database
    • Resubmit the Backup database node request
    • Modify and submit the Restore database node request with these options to restore the first set you created:
{
  "restore_config": {
    "source_database_id": "storefront",
    "source_node_name": "n1",
    "source_database_name": "storefront",
    "repository": {
      "id": "{{repository_id}}",
      "type": "posix",
      "base_path": "/backups"
    },
    "restore_options": {
      "type": "immediate",
      "set": "<set name from above>"
    }
  }
}
  • Validate that the data was restored to the database

PLAT-368

It's not possible to persist recovery options outside of the bootstrap
process and it's not possible to force Patroni into the bootstrap
process if the pgdata directory is non-empty.

So, this commit changes the in-place restore process to temporarily move
the pgdata directory to a different name. Then, it changes the bootstrap
command to simply move the pgdata directory back to its original name.
This lets us keep our existing restore process and makes patroni keep
the recovery options.

PLAT-368
@jason-lynch jason-lynch merged commit 57292e9 into main Dec 21, 2025
2 checks passed
@jason-lynch jason-lynch deleted the fix/PLAT-368/persist-recovery-opts branch December 21, 2025 23:15
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