Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2019-02-14 16:48:20 +0300
committerFelipe Artur <felipefac@gmail.com>2019-02-14 16:48:20 +0300
commit37741c59a4daf1b0d6d9f7a6a51337e9d8effb66 (patch)
tree4a4bc367617a4ad4e106ddeffeecf1cb013ad5e4 /db/migrate/20190211131150_add_state_id_to_issuables.rb
parent26f40aefb09b96538fa99f74d46542ad39bb1679 (diff)
Split background migration for issues and merge requests
Diffstat (limited to 'db/migrate/20190211131150_add_state_id_to_issuables.rb')
-rw-r--r--db/migrate/20190211131150_add_state_id_to_issuables.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/db/migrate/20190211131150_add_state_id_to_issuables.rb b/db/migrate/20190211131150_add_state_id_to_issuables.rb
index 440f577e1a3..cf3f7671a67 100644
--- a/db/migrate/20190211131150_add_state_id_to_issuables.rb
+++ b/db/migrate/20190211131150_add_state_id_to_issuables.rb
@@ -1,41 +1,11 @@
class AddStateIdToIssuables < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
- #include AfterCommitQueue
DOWNTIME = false
- MIGRATION = 'SyncIssuablesStateId'.freeze
-
- # 2019-02-12 Gitlab.com issuable numbers
- # issues count: 13587305
- # merge requests count: 18925274
- # Using this 25000 as batch size should take around 26 hours
- # to migrate both issues and merge requests
- BATCH_SIZE = 25000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class Issue < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'issues'
- end
-
- class MergeRequest < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'merge_requests'
- end
def up
add_column :issues, :state_id, :integer, limit: 2
add_column :merge_requests, :state_id, :integer, limit: 2
-
- # Is this safe?
- # Added to avoid an warning about jobs running inside transactions.
- # Since we only add a column this should be ok
- Sidekiq::Worker.skipping_transaction_check do
- queue_background_migration_jobs_by_range_at_intervals(Issue.where(state_id: nil), MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
- queue_background_migration_jobs_by_range_at_intervals(MergeRequest.where(state_id: nil), MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
- end
end
def down