From df63b03bb58f366e0d348695e5b875c4b7b2d9bd Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 27 Nov 2025 20:10:45 -0800 Subject: [PATCH] devex: add helm chart option to drop indexes on startup useful if making changes to indexes, but a full migration is not needed --- backend/btrixcloud/db.py | 2 ++ chart/templates/configmap.yaml | 1 + chart/values.yaml | 3 +++ 3 files changed, 6 insertions(+) diff --git a/backend/btrixcloud/db.py b/backend/btrixcloud/db.py index 0318915c2c..7f0bfbd9b2 100644 --- a/backend/btrixcloud/db.py +++ b/backend/btrixcloud/db.py @@ -131,6 +131,8 @@ async def update_and_prepare_db( crawl_manager, ): await drop_indexes(mdb) + elif os.environ.get("MONGO_DB_DROP_INDEXES"): + await drop_indexes(mdb) await create_indexes( org_ops, diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml index 3ec5c7f0bd..e6703caa24 100644 --- a/chart/templates/configmap.yaml +++ b/chart/templates/configmap.yaml @@ -45,6 +45,7 @@ data: IDLE_TIMEOUT: "{{ .Values.profile_browser_idle_seconds | default 60 }}" RERUN_FROM_MIGRATION: "{{ .Values.rerun_from_migration }}" + MONGO_DB_DROP_INDEXES: "{{ .Values.mongo_drop_indexes }}" MIGRATION_JOBS_SCALE: "{{ .Values.migration_jobs_scale | default 1 }}" PRESIGN_DURATION_MINUTES: "{{ .Values.storage_presign_duration_minutes }}" diff --git a/chart/values.yaml b/chart/values.yaml index 8762e6cfbe..92a1415bff 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -526,6 +526,9 @@ signer_memory: "50Mi" # see backend/btrixcloud/migrations/ for list of available migrations # rerun_from_migration: +# if set, will force mongodb to drop indexes on startup +# mongo_drop_indexes: 1 + # scale for certain migration background jobs # migration_jobs_scale: 1