Skip to content

Disable ultimate for projects less than 1 MB in size

Abdul Wadood requested to merge 364525-remove-ultimate-from-1-mb-repos into master

What does this MR do and why?

Disable ultimate features for projects less than 1 MB in size.

This is part of https://gitlab.com/groups/gitlab-org/-/epics/7467 which affects only gitlab.com and we have already announced the change to our users. For the open-source projects, the users need to enroll in our open-source program https://about.gitlab.com/solutions/open-source/.

Query plans

Query 1

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/11879/commands/42566

Sample Select Query
SELECT "project_settings"."project_id"
FROM "project_settings"
WHERE "project_settings"."project_id" BETWEEN 10000 AND 10250
  AND "project_settings"."legacy_open_source_license_available" = TRUE
  AND "project_settings"."project_id" >= 10000
ORDER BY "project_settings"."project_id" ASC
LIMIT 250 OFFSET 250;

Query 2

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/12003/commands/42569

Sample Update Query
UPDATE "project_settings"
SET "legacy_open_source_license_available" = FALSE,
    "updated_at"                           = '2022-09-09'
WHERE "project_settings"."project_id" IN (SELECT "project_settings"."project_id"
                                          FROM "project_settings"
                                                   LEFT OUTER JOIN project_statistics
                                                                   ON project_statistics.project_id = project_settings.project_id
                                          WHERE "project_settings"."project_id" BETWEEN 10000 AND 10250
                                            AND "project_settings"."legacy_open_source_license_available" = TRUE
                                            AND "project_settings"."project_id" >= 10000
                                            AND (project_statistics.repository_size < 1048576));

Migration output

up

bin/rails db:migrate:up:main VERSION=20220906074449
main: == 20220906074449 ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb: migrating
main: == 20220906074449 ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb: migrated (0.0010s)

down

bin/rails db:migrate:down:main VERSION=20220906074449
main: == 20220906074449 ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb: reverting
main: == 20220906074449 ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb: reverted (0.0010s)

Reversibility

This is a data migration that removes the ultimate license from projects less than 1MB in size. Reversing it would not be straight and would require restoring data from an earlier snapshot.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #364525

Edited by Abdul Wadood

Merge request reports

Loading