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:
Diffstat (limited to 'lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb')
-rw-r--r--lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb b/lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb
index e694e5359cd..7d150b9cd83 100644
--- a/lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb
+++ b/lib/gitlab/background_migration/migrate_merge_request_diff_commit_users.rb
@@ -14,7 +14,7 @@ module Gitlab
# The number of rows in merge_request_diff_commits to get in a single
# query.
- COMMIT_ROWS_PER_QUERY = 10_000
+ COMMIT_ROWS_PER_QUERY = 1_000
# The number of rows in merge_request_diff_commits to update in a single
# query.
@@ -78,6 +78,8 @@ module Gitlab
# rubocop: enable Style/Documentation
def perform(start_id, stop_id)
+ return if already_processed?(start_id, stop_id)
+
# This Hash maps user names + emails to their corresponding rows in
# merge_request_diff_commit_users.
user_mapping = {}
@@ -94,6 +96,13 @@ module Gitlab
)
end
+ def already_processed?(start_id, stop_id)
+ Database::BackgroundMigrationJob
+ .for_migration_execution('MigrateMergeRequestDiffCommitUsers', [start_id, stop_id])
+ .succeeded
+ .any?
+ end
+
# Returns the data we'll use to determine what merge_request_diff_commits
# rows to update, and what data to use for populating their
# commit_author_id and committer_id columns.