Browse Source

fix(backup): Hack around OrganizationMemberTeam race (#71125)

Alex Zaslavsky 9 months ago
parent
commit
cce3f9336e

+ 1 - 0
src/sentry/db/postgres/base.py

@@ -93,6 +93,7 @@ class CursorWrapper:
 
 class DatabaseWrapper(DjangoDatabaseWrapper):
     SchemaEditorClass = DatabaseSchemaEditorProxy
+    queries_limit = 10000
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)

+ 4 - 1
src/sentry/services/hybrid_cloud/import_export/impl.py

@@ -195,7 +195,10 @@ class UniversalImportExportService(ImportExportService):
             # themselves, and the remote versions will be synced a few minutes later, well before
             # any users are likely ot need to get ahold of them to view actual data in the UI.
             using = router.db_for_write(model)
-            with outbox_context(transaction.atomic(using=using), flush=False):
+            # HACK(azaslavsky): Need to figure out why `OrganizationMemberTeam` in particular is failing, but we can just use async outboxes for it for now.
+            with outbox_context(
+                transaction.atomic(using=using), flush=model_name != "sentry.organizationmemberteam"
+            ):
                 ok_relocation_scopes = import_scope.value
                 out_pk_map = PrimaryKeyMap()
                 min_old_pk = 0