diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-11 00:08:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-11 00:08:12 +0300 |
commit | ddfa6a1f19f1c6847d30314858f1d0ad21de13f9 (patch) | |
tree | 715fd181e594d7c6339d90eb8daaa45c962f2565 /db | |
parent | f27a1b0faf16a83ba9c3f71f660262e368f4509a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20230125093840_rebalance_partition_id_ci_build.rb | 30 | ||||
-rw-r--r-- | db/schema_migrations/20230125093840 | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/db/post_migrate/20230125093840_rebalance_partition_id_ci_build.rb b/db/post_migrate/20230125093840_rebalance_partition_id_ci_build.rb new file mode 100644 index 00000000000..6165c266a82 --- /dev/null +++ b/db/post_migrate/20230125093840_rebalance_partition_id_ci_build.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class RebalancePartitionIdCiBuild < Gitlab::Database::Migration[2.1] + MIGRATION = 'RebalancePartitionId' + DELAY_INTERVAL = 2.minutes.freeze + TABLE = :ci_builds + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 500 + + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + def up + return unless Gitlab.com? + + queue_batched_background_migration( + MIGRATION, + TABLE, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + return unless Gitlab.com? + + delete_batched_background_migration(MIGRATION, TABLE, :id, []) + end +end diff --git a/db/schema_migrations/20230125093840 b/db/schema_migrations/20230125093840 new file mode 100644 index 00000000000..1d2fab25619 --- /dev/null +++ b/db/schema_migrations/20230125093840 @@ -0,0 +1 @@ +c66f77a9de07e2f88b6d371b14f7f72068a5b8e25cb382cb08e578021affbeb7
\ No newline at end of file |