Skip to content

Bug fix/wait for hot backup#389

Merged
apetenchea merged 6 commits intomainfrom
bug-fix/wait-for-hot-backup
Mar 1, 2026
Merged

Bug fix/wait for hot backup#389
apetenchea merged 6 commits intomainfrom
bug-fix/wait-for-hot-backup

Conversation

@dothebart
Copy link
Collaborator

@dothebart dothebart commented Feb 26, 2026

carbon copy the waiting procedure from rta-makedata


Note

Low Risk
Low risk: test-only change that replaces a fixed sleep with a bounded poll of cluster_inventory; main risk is potential test flakiness/timeouts if the sync condition or API response changes.

Overview
Improves the backup restore integration test by replacing the fixed time.sleep(10) wait with wait_for_cluster_resilient, which polls sys_db.replication.cluster_inventory(include_system=True) until all collections report all_in_sync (with retries and a hard attempt limit).

Adds handling for transient ReplicationClusterInventoryError during polling and fails the test with an explicit exception if the cluster never becomes consistent within the limit.

Written by Cursor Bugbot for commit 9bab949. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Free Tier Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Loop never executes due to wrong initial value
    • Initialized collections_in_sync to False so the polling loop always executes and waits for synchronization.
  • ✅ Fixed: Iterating dict keys instead of collection objects
    • Changed the iteration to traverse collection objects from the inventory's collections list and nested databases before checking all_in_sync.

Create PR

Or push these changes by commenting:

@cursor push 058d64e5f9
Preview (058d64e5f9)
diff --git a/tests/test_backup.py b/tests/test_backup.py
--- a/tests/test_backup.py
+++ b/tests/test_backup.py
@@ -17,7 +17,7 @@
 
 
 def wait_for_cluster_resilient(sys_db):
-    collections_in_sync = True
+    collections_in_sync = False
     max_attempts = 100
 
     while not collections_in_sync and max_attempts > 0:
@@ -32,7 +32,11 @@
             max_attempts -= 1
             continue
 
-        for col in cols:
+        collections = list(cols.get("collections", []))
+        for db in cols.get("databases", {}).values():
+            collections.extend(db.get("collections", []))
+
+        for col in collections:
             collections_in_sync = collections_in_sync and col["all_in_sync"]
             if not col["all_in_sync"]:
                 count_still_waiting += 1
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@apetenchea apetenchea merged commit eb89d69 into main Mar 1, 2026
11 checks passed
@apetenchea apetenchea deleted the bug-fix/wait-for-hot-backup branch March 1, 2026 15:25
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