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

run backup before setting up replica #661

Merged
merged 5 commits into from
Mar 27, 2024
Merged

run backup before setting up replica #661

merged 5 commits into from
Mar 27, 2024

Conversation

nhudson
Copy link
Collaborator

@nhudson nhudson commented Mar 14, 2024

Since enabling snapshots with CNPG, we need a way to bring a potential new replica inline with the primary instance. Currently CNPG states that you must take a backup before bringing a new replica online.

We have opened an issue with CNPG in hopes to build a better solution to this problem. cloudnative-pg/cloudnative-pg#4125

Currently the logic works like this
if increasing replicas (1->2)

  • If there was a backup taken in the last 45 minutes, continue bringing the new replica online.
    • Otherwise, take a backup
  • If there is a backup in pending or running
    • requeue.
  • Continue to rest of code that increases the replicas

fixes: PLAT-117

@nhudson nhudson self-assigned this Mar 14, 2024
@nhudson nhudson marked this pull request as ready for review March 26, 2024 19:30
@@ -4166,7 +4166,8 @@ CREATE EVENT TRIGGER pgrst_watch
// Wait for Postgres to restart
{
let started = Utc::now();
let max_wait_time = chrono::Duration::seconds(TIMEOUT_SECONDS_POD_READY as _);
let max_wait_time =
chrono::TimeDelta::try_seconds(TIMEOUT_SECONDS_POD_READY as _).unwrap();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -4220,7 +4221,7 @@ CREATE EVENT TRIGGER pgrst_watch
async fn functional_test_status_configs() {
async fn runtime_cfg(coredbs: &Api<CoreDB>, name: &str) -> Option<Vec<PgConfig>> {
let started_waiting = Utc::now();
let max_wait_time = chrono::Duration::seconds(45);
let max_wait_time = chrono::TimeDelta::try_seconds(45).unwrap();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nhudson nhudson merged commit c66e2c0 into main Mar 27, 2024
9 checks passed
@nhudson nhudson deleted the nhudson/PLAT-117 branch March 27, 2024 13:47
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