Add a single feature flag to disable all ddl across the database
What does this MR do and why?
Adds a single ops feature-flag that disables all DDL feature-flags being used across the GitLab database.
Adds disallow_database_ddl_feature_flags
– disabled by default. When it's set to true
, it will disable all other flags.
Feature flags were identified as
- partition_manager_sync_partitions
- execute_batched_migrations_on_schedule
- execute_background_migrations
- database_reindexing
- database_async_index_operations
- database_async_foreign_key_validation
- database_async_index_creation
These flags are manually disabled during PostgreSQL
upgrade: https://ops.gitlab.net/gitlab-com/gl-infra/db-migration/-/issues/58#note_170932
Screenshots or screen recordings
All the flags are enabled in production:
![](/-/project/278964/uploads/a0f81f6360b0d1cbd1c8a984072e27eb/flag-1.png)
![](/-/project/278964/uploads/1a835ff408b48baf138928270ab1f867/flag-2.png)
![](/-/project/278964/uploads/f7de18f405b9cbbfd1de040b40bb0293/flag-3.png)
![](/-/project/278964/uploads/77e0a43240a4b035dc07850f6857c274/flag-4.png)
![](/-/project/278964/uploads/6a2df9fbb565585d8a377e990f6cd7d5/flag-5.png)
![](/-/project/278964/uploads/bd9dc7a56a114f965e50c946d4fd874d/flag-6.png)
![](/-/project/278964/uploads/0c9d537993632b64615441d0d28f895a/flag-7.png)
How to set up and validate locally
- Use this snippet
Note: Gitlab::Database::Reindexing.invoke('main')
is quite tricky to test. You should check the queries triggered in the console.
- Test for
db.rake
echo "Feature.enable(:disallow_database_ddl_feature_flags)" | bundle exec rails c
bundle exec rake gitlab:db:enqueue_reindexing_action\[public.projects_pkey\]
bundle exec rake gitlab:db:execute_async_index_operations:main
bundle exec rake gitlab:db:validate_async_constraints:main
You should see the following message for the three tasks:
Note: disallow_database_ddl_feature_flags feature is currently enabled. Disable it to proceed.
Disable with: Feature.disable(:disallow_database_ddl_feature_flags)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #417161 (closed)