Krasimir Angelov activity https://gitlab.com/krasio 2026-03-18T03:36:36Z tag:gitlab.com,2026-03-18:5215551137 Krasimir Angelov opened merge request !227826: Backport https://gitlab.com/gitlab-org/gitlab/-/merge_requests/227592 in 18.9 at GitLab.org / GitLab 2026-03-18T03:36:36Z krasio Krasimir Angelov [email protected]

What does this MR do and why?

Backport !227592 into 18.9. This executes all migration affected by the bug fixed with !224446.

How to test

The best way is to test on a fresh Omnibus install as described in this snippet:

  1. Install 18.7.0
  2. Create single record for pool_repositiories
    • in sudo gitlab-rails c session
      class TestProject < ApplicationRecord
         self.table_name = 'projects'
       end
      
      project = TestProject.create!(organization_id: 1, namespace_id: 1, project_namespace_id: 1, name: 'Project 1', path: 'project-1')
    • in sudo gitlab-psql session
      drop trigger pool_repositories_loose_fk_trigger on pool_repositories ;
      insert into pool_repositories (shard_id, source_project_id) select 1, id from projects limit 1;
      create trigger pool_repositories_loose_fk_trigger AFTER DELETE ON pool_repositories REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
  3. Upgrade to 18.8.0, background migration finished but the row in pool_repositories will not be updated.
  4. Upgrade to 18.9.0. This will fail with PG::CheckViolation: ERROR: check constraint "check_96233d37c0"...
  5. Copy the migration
  6. Execute sudo gitlab-rails db:migrate, all migrations should succeed
  7. Retry upgrade, it should succeed

MR acceptance checklist

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

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
  • Required labels have been applied to this merge request
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:test-on-omnibus-ee job has succeeded, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, reach out to a Software Engineer in Test in #s_developer_experience.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

tag:gitlab.com,2026-03-18:5215541702 Krasimir Angelov pushed new project branch ka/backport/18-9/bbm-single-row-bug at GitLab.org / GitLab 2026-03-18T03:30:09Z krasio Krasimir Angelov [email protected]

Krasimir Angelov (15b84d6f) at 18 Mar 03:30

Backport !227592

... and 70 more commits

tag:gitlab.com,2026-03-18:5215536547 Krasimir Angelov commented on merge request !227592 at GitLab.org / GitLab 2026-03-18T03:26:58Z krasio Krasimir Angelov [email protected]

@praba.m7n This is ready for review. I will move to preparing the back-ports meanwhile.

tag:gitlab.com,2026-03-18:5215301538 Krasimir Angelov commented on merge request !227592 at GitLab.org / GitLab 2026-03-18T01:01:38Z krasio Krasimir Angelov [email protected]

This fails because of a guard in https://gitlab.com/gitlab-org/database-team/gitlab-com-database-testing/-/blob/master/docker/gitlab/patches/0005-Patch-finalize-BBM-helper.patch?ref_type=heads#L20-22.

tag:gitlab.com,2026-03-18:5215229133 Krasimir Angelov commented on merge request !227592 at GitLab.org / GitLab 2026-03-18T00:16:11Z krasio Krasimir Angelov [email protected]

Seems to work fine with namespaces class names:

> Gitlab::BackgroundMigration.const_defined?('RemoteDevelopment::BmDesiredConfigArrayValidator')
=> true
tag:gitlab.com,2026-03-18:5215215544 Krasimir Angelov commented on merge request !227592 at GitLab.org / GitLab 2026-03-18T00:09:16Z krasio Krasimir Angelov [email protected]

We use send here to avoid BackgroundMigration/DictionaryFile cop failing with an error because of m.job_class_name. Disabling this rule did not help.

tag:gitlab.com,2026-03-18:5215212804 Krasimir Angelov commented on merge request !227592 at GitLab.org / GitLab 2026-03-18T00:07:58Z krasio Krasimir Angelov [email protected]

Pick only background migration compatible with the current migration's schema.

tag:gitlab.com,2026-03-18:5215192959 Krasimir Angelov pushed to project branch ka/fix/bbm-single-record at GitLab.org / GitLab 2026-03-18T00:02:42Z krasio Krasimir Angelov [email protected]

Krasimir Angelov (7d450b81) at 18 Mar 00:02

Execute BBM affected by single record table bug

tag:gitlab.com,2026-03-17:5210896642 Krasimir Angelov commented on merge request !221731 at GitLab.org / GitLab 2026-03-17T04:28:05Z krasio Krasimir Angelov [email protected]

@ahegyi Sorry, I was busy with some other work, will look at this as soon as I can.

tag:gitlab.com,2026-03-17:5210895689 Krasimir Angelov commented on merge request !19 at GitLab.org / Database Team / Update Status 2026-03-17T04:27:24Z krasio Krasimir Angelov [email protected]

@praba.m7n Sorry, I was busy with some other work, will look at this as soon as I can.

tag:gitlab.com,2026-03-17:5210895425 Krasimir Angelov commented on merge request !227418 at GitLab.org / GitLab 2026-03-17T04:27:14Z krasio Krasimir Angelov [email protected]

@patrickbajao Sorry, I was busy with some other work, will look at this as soon as I can.

tag:gitlab.com,2026-03-17:5210894692 Krasimir Angelov commented on merge request !218827 at GitLab.org / GitLab 2026-03-17T04:26:43Z krasio Krasimir Angelov [email protected]

@tskorupa-gl Sorry, I was busy with some other work, will look at this as soon as I can.

tag:gitlab.com,2026-03-17:5210893912 Krasimir Angelov commented on merge request !225419 at GitLab.org / GitLab 2026-03-17T04:26:13Z krasio Krasimir Angelov [email protected]

@zhaochen_li Sorry, I was busy with some other work, will look at this as soon as I can.

tag:gitlab.com,2026-03-17:5210891516 Krasimir Angelov commented on merge request !227004 at GitLab.org / GitLab 2026-03-17T04:24:38Z krasio Krasimir Angelov [email protected]

I've started working on the above approach in Execute BBM affected by single record table bug (!227592).

We should try get this in 18.10.1 (as it's too late for 18.10) and then back-post to 18.9 and 18.8.

@praba.m7n As Max is away I may need help from you to review merge. 🙏 Will assign to you once ready.

tag:gitlab.com,2026-03-17:5210889077 Krasimir Angelov opened merge request !227592: Execute BBM affected by single record table bug at GitLab.org / GitLab 2026-03-17T04:23:05Z krasio Krasimir Angelov [email protected]

What does this MR do and why?

Execute BBM affected by single record table bug

Execute BBMs affected by #590848. This is in addition to !225461 which was not enough as just marked the migrations as paused.

References

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

tag:gitlab.com,2026-03-17:5210885070 Krasimir Angelov pushed new project branch ka/fix/bbm-single-record at GitLab.org / GitLab 2026-03-17T04:20:29Z krasio Krasimir Angelov [email protected]

Krasimir Angelov (198ce3f4) at 17 Mar 04:20

Execute BBM affected by single record table bug

tag:gitlab.com,2026-03-17:5210537074 Krasimir Angelov commented on merge request !227004 at GitLab.org / GitLab 2026-03-17T00:41:41Z krasio Krasimir Angelov [email protected]

While testing this locally I realized this is not going to solve the issue. Even if we set the status of the potentially affected migrations back to active the following migrations like 20260209093954 will still fail because:

  • they are executed immediately after the migration from this MR.
  • even if we wait when doing downtime upgrades Sidekiq is stopped so there is no worker to process them.

A better approach will be to finalize these migrations so they are completed when depending migrations are executed.

/cc @morefice @praba.m7n @alexives

tag:gitlab.com,2026-03-16:5206358494 Krasimir Angelov commented on merge request !227418 at GitLab.org / GitLab 2026-03-16T04:23:21Z krasio Krasimir Angelov [email protected]

@patrickbajao Good catch! This table was created a while ago (in 18.0) but partitions were not managed properly as public.merge_request_commits_metadata_id_seq was used. How will this change affect existing instances? 🤔