Cleanup background migration to copy container_registry_enabled to project_features table
What does this MR do?
A background migration to copy projects.container_registry_enabled
to project_features.container_registry_access_level
was added in !59513 (merged). It has been included in the 13.12 release. So this cleanup migration should only be merged in 14.0.
This MR contains the cleanup migration for the above background migration. The Sidekiq jobs of the background migration were tracked using the background_migration_jobs
table. 28 jobs failed (due to exclusive lease contention) on gitlab.com.
After the background migration completes, project_features.container_registry_access_level
will continue to be kept up-to-date with projects.container_registry_enabled
by a before_update
callback on Project
model and a before_create
callback on ProjectFeature
model, which were added in !55327 (merged).
Estimate:
21,000 rows per sidekiq job.
300 rows per batch in job.
21,000 / 300 = 70 batches per job
Estimated times per batch:
907ms for update statement with 300 items (from https://console.postgres.ai/shared/0b28c145-2f28-40f1-95b9-fa46b0ee25b1)
Execution time per sidekiq job:
907 * 70 = 63.49 seconds
Total time to execute 28 jobs should be 28 * 63.49 ~= 1777 secs ~= 30 mins
This is higher than the 10 minute guideline, but on production it should be faster. Also, there are only 3 rows on gitlab.com that actually need to be updated, so most of the queries won't need to update the table, which should make them faster.
Migration output:
== 20210513163904 CleanupMoveContainerRegistryEnabledToProjectFeature: migrating
== 20210513163904 CleanupMoveContainerRegistryEnabledToProjectFeature: migrated (0.0231s)
Revert output:
== 20210513163904 CleanupMoveContainerRegistryEnabledToProjectFeature: reverting
== 20210513163904 CleanupMoveContainerRegistryEnabledToProjectFeature: reverted (0.0000s)
Related to #18792 (closed)
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - Tested in all supported browsers
- Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- Label as security and @ mention
@gitlab-com/gl-security/appsec
- The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- Security reports checked/validated by a reviewer from the AppSec team