From 249baa0f71b4ac89b4135de965d806b5d35a5122 Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 1 Dec 2025 07:51:23 -0500 Subject: [PATCH 1/9] Backfill uploads with sharding key Addresses https://gitlab.com/gitlab-org/gitlab/-/work_items/398199#proposal Changelog: other --- .../backfill_partitioned_uploads.yml | 4 +-- ...4216_queue_backfill_partitioned_uploads.rb | 13 +++------ ...re_enqueue_backfill_partitioned_uploads.rb | 29 +++++++++++++++++++ db/schema_migrations/20251201121648 | 1 + .../backfill_partitioned_uploads.rb | 10 +++---- ...queue_backfill_partitioned_uploads_spec.rb | 27 +++++++++++++++++ ...queue_backfill_partitioned_uploads_spec.rb | 8 +---- 7 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb create mode 100644 db/schema_migrations/20251201121648 create mode 100644 spec/migrations/20251201121648_queue_re_enqueue_backfill_partitioned_uploads_spec.rb diff --git a/db/docs/batched_background_migrations/backfill_partitioned_uploads.yml b/db/docs/batched_background_migrations/backfill_partitioned_uploads.yml index 1e1e619c25bc96..225908f0438cd5 100644 --- a/db/docs/batched_background_migrations/backfill_partitioned_uploads.yml +++ b/db/docs/batched_background_migrations/backfill_partitioned_uploads.yml @@ -4,5 +4,5 @@ description: Back-fill partitoned uploads_9ba88c4165 table and populate sharding feature_category: database introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181349 milestone: '18.2' -queued_migration_version: 20250609164216 -finalized_by: 20250717035404 +queued_migration_version: 20251201121648 +finalized_by: diff --git a/db/post_migrate/20250609164216_queue_backfill_partitioned_uploads.rb b/db/post_migrate/20250609164216_queue_backfill_partitioned_uploads.rb index ab0affe6c6526c..d71548bd2558ae 100644 --- a/db/post_migrate/20250609164216_queue_backfill_partitioned_uploads.rb +++ b/db/post_migrate/20250609164216_queue_backfill_partitioned_uploads.rb @@ -11,17 +11,12 @@ class QueueBackfillPartitionedUploads < Gitlab::Database::Migration[2.3] SUB_BATCH_SIZE = 300 def up - queue_batched_background_migration( - MIGRATION, - :uploads, - :id, - job_interval: DELAY_INTERVAL, - batch_size: BATCH_SIZE, - sub_batch_size: SUB_BATCH_SIZE - ) + # no-op: + # This migration is a no-op because the original migration was re-enqueued with a new version. + # The new migration is 20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb end def down - delete_batched_background_migration(MIGRATION, :uploads, :id, []) + # no-op end end diff --git a/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb b/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb new file mode 100644 index 00000000000000..08a291810b4a47 --- /dev/null +++ b/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class QueueReEnqueueBackfillPartitionedUploads < Gitlab::Database::Migration[2.3] + milestone '18.7' + + restrict_gitlab_migration gitlab_schema: :gitlab_main_org + + MIGRATION = "BackfillPartitionedUploads" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 7000 + SUB_BATCH_SIZE = 300 + + def up + delete_batched_background_migration(MIGRATION, :uploads, :id, []) + + queue_batched_background_migration( + MIGRATION, + :uploads, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :uploads, :id, []) + end +end diff --git a/db/schema_migrations/20251201121648 b/db/schema_migrations/20251201121648 new file mode 100644 index 00000000000000..4e5c76284277de --- /dev/null +++ b/db/schema_migrations/20251201121648 @@ -0,0 +1 @@ +a8ce96b5ba09fa3f3aedf0f10724cba6963f978c09f26fafb9841ae1ca844a14 \ No newline at end of file diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index 2ecc8b0bd377b9..e0d38e1e963e8b 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -21,7 +21,7 @@ def perform private def sharding_key_columns - %w[organization_id namespace_id project_id] + %w[organization_id namespace_id project_id uploaded_by_user_id] end def columns @@ -31,11 +31,11 @@ def columns def tables_and_models # model_table, model_name, sources, targets, join_key, db_name [ - ['abuse_reports', 'AbuseReport', %w[]], + ['abuse_reports', 'AbuseReport', %w[organization_id]], ['achievements', 'Achievements::Achievement', %w[namespace_id]], ['ai_vectorizable_files', 'Ai::VectorizableFile', %w[project_id]], ['alert_management_alert_metric_images', 'AlertManagement::MetricImage', %w[project_id]], - ['appearances', 'Appearance', %w[]], + ['appearances', 'Appearance', %w[]], # cell-local table ['bulk_import_export_uploads', 'BulkImports::ExportUpload', %w[group_id project_id], %w[namespace_id project_id]], ['design_management_designs_versions', 'DesignManagement::Action', %w[namespace_id]], @@ -47,8 +47,8 @@ def tables_and_models ['topics', 'Projects::Topic', %w[organization_id]], ['projects', 'Project', %w[id], %w[project_id]], ['snippets', 'Snippet', %w[organization_id]], - ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[]], - ['users', 'User', %w[]], + ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id]], + ['users', 'User', %w[organization_id]], # Sec tables ['dependency_list_exports', 'Dependencies::DependencyListExport', %w[organization_id group_id project_id], %w[organization_id namespace_id project_id], nil, :sec], diff --git a/spec/migrations/20251201121648_queue_re_enqueue_backfill_partitioned_uploads_spec.rb b/spec/migrations/20251201121648_queue_re_enqueue_backfill_partitioned_uploads_spec.rb new file mode 100644 index 00000000000000..8016af95faab6e --- /dev/null +++ b/spec/migrations/20251201121648_queue_re_enqueue_backfill_partitioned_uploads_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe QueueReEnqueueBackfillPartitionedUploads, migration: :gitlab_main_org, feature_category: :database do + let!(:batched_migration) { described_class::MIGRATION } + + it 'schedules a new batched migration' do + reversible_migration do |migration| + migration.before -> { + expect(batched_migration).not_to have_scheduled_batched_migration + } + + migration.after -> { + expect(batched_migration).to have_scheduled_batched_migration( + gitlab_schema: :gitlab_main_org, + table_name: :uploads, + column_name: :id, + interval: described_class::DELAY_INTERVAL, + batch_size: described_class::BATCH_SIZE, + sub_batch_size: described_class::SUB_BATCH_SIZE + ) + } + end + end +end diff --git a/spec/migrations/queue_backfill_partitioned_uploads_spec.rb b/spec/migrations/queue_backfill_partitioned_uploads_spec.rb index 5b916d76a7422a..65d9bd15320428 100644 --- a/spec/migrations/queue_backfill_partitioned_uploads_spec.rb +++ b/spec/migrations/queue_backfill_partitioned_uploads_spec.rb @@ -13,13 +13,7 @@ } migration.after -> { - expect(batched_migration).to have_scheduled_batched_migration( - table_name: :uploads, - column_name: :id, - interval: described_class::DELAY_INTERVAL, - batch_size: described_class::BATCH_SIZE, - sub_batch_size: described_class::SUB_BATCH_SIZE - ) + expect(batched_migration).not_to have_scheduled_batched_migration } end end -- GitLab From 0e20befd35bc697486898db2788e9205ca19f324 Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Tue, 9 Dec 2025 14:34:24 -0500 Subject: [PATCH 2/9] fixup! Backfill uploads with sharding key --- .../backfill_partitioned_uploads_spec.rb | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb b/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb index 3da66f0cd1c0cb..866c056881a28a 100644 --- a/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb @@ -452,10 +452,13 @@ def create_user(organization_id:) organization_id: organization_id) end - def create_upload(model_type, model, delete_model: false) + # NOTE: provide `uploads_sharding_key` when the uploads partition does not have a trigger to set + # the sharding key column from the parent table (eg. when the parent table belongs to the + # gitlab_sec schema but the uploads partition belongs in the gitlab_main_org schema) + def create_upload(model_type, model, delete_model: false, uploads_sharding_key: {}) model_id = Array.wrap(model.id).first uploads_table.create!(model_type: model_type, model_id: model_id, size: 42, path: '/some/path', - uploader: 'FileUploader', created_at: Time.current).tap do + uploader: 'FileUploader', created_at: Time.current, **uploads_sharding_key).tap do model.delete if delete_model end end @@ -466,7 +469,9 @@ def create_achievement end def create_abuse_report_upload(delete_model: false) - model = abuse_reports.create! + organization = create_organization + reporter = create_user(organization_id: organization.id) + model = abuse_reports.create!(reporter_id: reporter.id) create_upload('AbuseReport', model, delete_model: delete_model) end @@ -512,7 +517,8 @@ def create_dependency_list_export def create_dependency_list_export_upload(model: nil, delete_model: false) model ||= create_dependency_list_export - create_upload('Dependencies::DependencyListExport', model, delete_model: delete_model) + create_upload('Dependencies::DependencyListExport', model, delete_model: delete_model, + uploads_sharding_key: { namespace_id: model.group_id }) end def create_dependency_list_export_part @@ -524,7 +530,8 @@ def create_dependency_list_export_part def create_dependency_list_export_part_upload(model: nil, delete_model: false) model ||= create_dependency_list_export_part - create_upload('Dependencies::DependencyListExport::Part', model, delete_model: delete_model) + create_upload('Dependencies::DependencyListExport::Part', model, delete_model: delete_model, + uploads_sharding_key: { organization_id: model.organization_id }) end def create_import_export_upload @@ -549,7 +556,7 @@ def create_issuable_metric_image end def create_issuable_metric_image_upload(model: nil, delete_model: false) - model ||= create_import_export_upload + model ||= create_issuable_metric_image create_upload('IssuableMetricImage', model, delete_model: delete_model) end @@ -611,7 +618,8 @@ def create_vulnerability_export def create_vulnerability_export_upload(model: nil, delete_model: false) model ||= create_vulnerability_export - create_upload('Vulnerabilities::Export', model, delete_model: delete_model) + create_upload('Vulnerabilities::Export', model, delete_model: delete_model, + uploads_sharding_key: { organization_id: model.organization_id }) end def create_vulnerability_export_part @@ -623,7 +631,8 @@ def create_vulnerability_export_part def create_vulnerability_export_part_upload(model: nil, delete_model: false) model ||= create_vulnerability_export_part - create_upload('Vulnerabilities::Export::Part', model, delete_model: delete_model) + create_upload('Vulnerabilities::Export::Part', model, delete_model: delete_model, + uploads_sharding_key: { organization_id: model.organization_id }) end def create_vulnerability_remediation @@ -633,7 +642,8 @@ def create_vulnerability_remediation def create_vulnerability_remediation_upload(model: nil, delete_model: false) model ||= create_vulnerability_remediation - create_upload('Vulnerabilities::Remediation', model, delete_model: delete_model) + create_upload('Vulnerabilities::Remediation', model, delete_model: delete_model, + uploads_sharding_key: { project_id: model.project_id }) end def create_vulnerability_archive_export @@ -645,7 +655,8 @@ def create_vulnerability_archive_export def create_vulnerability_archive_export_upload(model: nil, delete_model: false) model ||= create_vulnerability_archive_export - create_upload('Vulnerabilities::ArchiveExport', model, delete_model: delete_model) + create_upload('Vulnerabilities::ArchiveExport', model, delete_model: delete_model, + uploads_sharding_key: { project_id: model.project_id }) end def create_project_upload(model: nil, delete_model: false) -- GitLab From 1453e70897c403561dfbd5a2ec110f6692555027 Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Fri, 12 Dec 2025 11:21:00 -0500 Subject: [PATCH 3/9] fixup! fixup! Backfill uploads with sharding key --- ...0717035404_finalize_partitioned_uploads_backfill.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/db/post_migrate/20250717035404_finalize_partitioned_uploads_backfill.rb b/db/post_migrate/20250717035404_finalize_partitioned_uploads_backfill.rb index 8a4d4371102648..07fddb2ae646a4 100644 --- a/db/post_migrate/20250717035404_finalize_partitioned_uploads_backfill.rb +++ b/db/post_migrate/20250717035404_finalize_partitioned_uploads_backfill.rb @@ -8,13 +8,9 @@ class FinalizePartitionedUploadsBackfill < Gitlab::Database::Migration[2.3] restrict_gitlab_migration gitlab_schema: :gitlab_main def up - ensure_batched_background_migration_is_finished( - job_class_name: 'BackfillPartitionedUploads', - table_name: :uploads, - column_name: :id, - job_arguments: [], - finalize: true - ) + # no-op: + # This migration is a no-op because the original migration was re-enqueued with a new version. + # The new migration is 20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb end def down; end -- GitLab From 37cdce1c15cc0bf894568e4753f8d4e522f93048 Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Fri, 12 Dec 2025 12:13:50 -0500 Subject: [PATCH 4/9] fixup! fixup! fixup! Backfill uploads with sharding key --- .../background_migration/backfill_partitioned_uploads.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index e0d38e1e963e8b..3055d9dfafef16 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -21,7 +21,10 @@ def perform private def sharding_key_columns - %w[organization_id namespace_id project_id uploaded_by_user_id] + # NOTE: `uploaded_by_user_id` is also a sharding key column for tables that belong in the + # gitlab_main_user schema. We want to copy over the column (instead of nullifying it) + # since `uploaded_by_user_id` is an integral part of uploads (to know who an upload was made by). + %w[organization_id namespace_id project_id] end def columns -- GitLab From ac09c2ec089274ec3620be5b42757e8e6f840311 Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 15 Dec 2025 11:27:46 -0500 Subject: [PATCH 5/9] Update milestone to 18.8 --- ...51201121648_queue_re_enqueue_backfill_partitioned_uploads.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb b/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb index 08a291810b4a47..2f18004f4de049 100644 --- a/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb +++ b/db/post_migrate/20251201121648_queue_re_enqueue_backfill_partitioned_uploads.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class QueueReEnqueueBackfillPartitionedUploads < Gitlab::Database::Migration[2.3] - milestone '18.7' + milestone '18.8' restrict_gitlab_migration gitlab_schema: :gitlab_main_org -- GitLab From 7cbb0fdcd7adb3399fdfaf49a1d8dd3d0fabf68d Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 15 Dec 2025 13:14:11 -0500 Subject: [PATCH 6/9] fixup! fixup! fixup! fixup! Backfill uploads with sharding key --- lib/gitlab/background_migration/backfill_partitioned_uploads.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index 3055d9dfafef16..efc4a5b81d2a23 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -83,7 +83,7 @@ def process_upload_type(sub_batch, model_table, model_name, sources, targets, jo # Columns that will be reset (nullified) as they are not used for sharding keys reset_columns = sharding_key_columns - targets # All columns to back-fill - target_columns = (columns + targets + reset_columns).join(', ') + target_columns = (columns + targets + reset_columns).uniq.join(', ') # All columns to source from source_columns = source_columns_sql(sources, reset_columns) # For existing records update only sharding key columns (if any) -- GitLab From f62741c45473f02e42f1b6530f311e2f03bb3c0a Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 15 Dec 2025 13:40:02 -0500 Subject: [PATCH 7/9] fixup! fixup! fixup! fixup! fixup! Backfill uploads with sharding key --- .../backfill_partitioned_uploads.rb | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index efc4a5b81d2a23..52db7d7f40dd9f 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -12,23 +12,27 @@ class Upload < ApplicationRecord def perform each_sub_batch do |sub_batch| - tables_and_models.each do |model_table, model_name, sources, targets, join_key, db_name| - process_upload_type(sub_batch, model_table, model_name, sources, targets, join_key, db_name) + tables_and_models.each do |model_table, model_name, sources, targets, join_key, db_name, db_schema| + process_upload_type(sub_batch, model_table, model_name, sources, targets, join_key, db_name, db_schema) end end end private - def sharding_key_columns + def sharding_key_columns(db_schema) # NOTE: `uploaded_by_user_id` is also a sharding key column for tables that belong in the # gitlab_main_user schema. We want to copy over the column (instead of nullifying it) # since `uploaded_by_user_id` is an integral part of uploads (to know who an upload was made by). - %w[organization_id namespace_id project_id] + if db_schema == :gitlab_main_user + %w[uploaded_by_user_id] + else + %w[organization_id namespace_id project_id] + end end - def columns - Upload.column_names - sharding_key_columns + def columns(db_schema) + Upload.column_names - sharding_key_columns(db_schema) end def tables_and_models @@ -50,7 +54,7 @@ def tables_and_models ['topics', 'Projects::Topic', %w[organization_id]], ['projects', 'Project', %w[id], %w[project_id]], ['snippets', 'Snippet', %w[organization_id]], - ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id]], + ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id], nil, nil, :gitlab_main_user], ['users', 'User', %w[organization_id]], # Sec tables ['dependency_list_exports', 'Dependencies::DependencyListExport', %w[organization_id group_id project_id], @@ -76,19 +80,19 @@ def tables_and_models # targets - sharding key columns to back-fill # join_key - column to join with the model table, defaults to id # db_name - database the model table belongs to - def process_upload_type(sub_batch, model_table, model_name, sources, targets, join_key, db_name) + def process_upload_type(sub_batch, model_table, model_name, sources, targets, join_key, db_name, db_schema) relation = sub_batch.select(:id, :model_type).limit(sub_batch_size) targets ||= sources join_key ||= 'id' # Columns that will be reset (nullified) as they are not used for sharding keys - reset_columns = sharding_key_columns - targets + reset_columns = sharding_key_columns(db_schema) - targets # All columns to back-fill - target_columns = (columns + targets + reset_columns).uniq.join(', ') + target_columns = (columns(db_schema) + targets + reset_columns).join(', ') # All columns to source from - source_columns = source_columns_sql(sources, reset_columns) + source_columns = source_columns_sql(sources, reset_columns, db_schema) # For existing records update only sharding key columns (if any) on_conflict = if targets.any? - "UPDATE SET #{sharding_key_columns.map { |c| "#{c} = EXCLUDED.#{c}" }.join(', ')}" + "UPDATE SET #{sharding_key_columns(db_schema).map { |c| "#{c} = EXCLUDED.#{c}" }.join(', ')}" else "NOTHING" end @@ -100,7 +104,7 @@ def process_upload_type(sub_batch, model_table, model_name, sources, targets, jo sec_cte = sec_model_values_cte(sub_batch, model_name, join_key, sources, model_table) return unless sec_cte - source_columns = source_columns_sql(sources, reset_columns, nullif: true) + source_columns = source_columns_sql(sources, reset_columns, db_schema, nullif: true) model_values_cte = sec_cte end @@ -120,9 +124,9 @@ def process_upload_type(sub_batch, model_table, model_name, sources, targets, jo connection.execute(upsert) end - def source_columns_sql(sources, reset_columns, nullif: false) + def source_columns_sql(sources, reset_columns, db_schema, nullif: false) ( - columns.map { |c| "uploads.#{c}" } + + columns(db_schema).map { |c| "uploads.#{c}" } + # Convert -1 back to NULL using NULLIF sources.map { |c| nullif ? "NULLIF(model.#{c}, -1)" : "model.#{c}" } + reset_columns.map { 'NULL' } -- GitLab From 66034e34939e1c25d84464aef5b60126f36fc5ee Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 15 Dec 2025 15:44:35 -0500 Subject: [PATCH 8/9] fixup! fixup! fixup! fixup! fixup! fixup! Backfill uploads with sharding key --- .../background_migration/backfill_partitioned_uploads.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index 52db7d7f40dd9f..7e7d1ab2c4d90a 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -54,7 +54,8 @@ def tables_and_models ['topics', 'Projects::Topic', %w[organization_id]], ['projects', 'Project', %w[id], %w[project_id]], ['snippets', 'Snippet', %w[organization_id]], - ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id], nil, nil, :gitlab_main_user], + ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id], nil, nil, + :gitlab_main_user], ['users', 'User', %w[organization_id]], # Sec tables ['dependency_list_exports', 'Dependencies::DependencyListExport', %w[organization_id group_id project_id], -- GitLab From 139be0c79f67f5ee89fe70cc34eae5aad0ea7eaf Mon Sep 17 00:00:00 2001 From: Tomasz Skorupa Date: Mon, 15 Dec 2025 15:52:24 -0500 Subject: [PATCH 9/9] fixup! fixup! fixup! fixup! fixup! fixup! fixup! Backfill uploads with sharding key --- .../background_migration/backfill_partitioned_uploads.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb index 7e7d1ab2c4d90a..33061690dd32a5 100644 --- a/lib/gitlab/background_migration/backfill_partitioned_uploads.rb +++ b/lib/gitlab/background_migration/backfill_partitioned_uploads.rb @@ -54,8 +54,8 @@ def tables_and_models ['topics', 'Projects::Topic', %w[organization_id]], ['projects', 'Project', %w[id], %w[project_id]], ['snippets', 'Snippet', %w[organization_id]], - ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id], nil, nil, - :gitlab_main_user], + ['user_permission_export_uploads', 'UserPermissionExportUpload', %w[user_id], %w[uploaded_by_user_id], nil, + nil, :gitlab_main_user], ['users', 'User', %w[organization_id]], # Sec tables ['dependency_list_exports', 'Dependencies::DependencyListExport', %w[organization_id group_id project_id], -- GitLab