diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 12:06:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 12:06:19 +0000 |
commit | 69849c280c5525d132ebaddb1200c390a42ecc06 (patch) | |
tree | 2c6ffc6fd6dc4fa719305f25b475391730389747 /db | |
parent | c157f963db87a40a3ba7b94b339530ee83194bc8 (diff) | |
download | gitlab-ce-69849c280c5525d132ebaddb1200c390a42ecc06.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb new file mode 100644 index 00000000000..0cd24da50d0 --- /dev/null +++ b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class SchedulePagesMetadataMigration < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + BATCH_SIZE = 10_000 + MIGRATION = 'MigratePagesMetadata' + + disable_ddl_transaction! + + class Project < ActiveRecord::Base + include ::EachBatch + + self.table_name = 'projects' + end + + def up + say "Scheduling `#{MIGRATION}` jobs" + + # At the time of writing there are ~10_669_292 records to be inserted for GitLab.com, + # batches of 10_000 with delay interval of 2 minutes gives us an estimate of close to 36 hours. + queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE) + end + + def down + # no-op + end +end |