summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-09 16:28:29 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-09 16:28:29 +0000
commit5782a03f59cc42ce643d2a96a7b5765ac6a51b9f (patch)
treeb891936184fd4fab1474b454ffd4b29c7759a907
parent6b214a5d87e9a7a57b3da1b9605626e516f65d1a (diff)
parent224e104d8dc79e081fd897a1e52799dc1a0082bb (diff)
downloadgitlab-ce-5782a03f59cc42ce643d2a96a7b5765ac6a51b9f.tar.gz
Merge branch 'fix_initial_push_mass_sql' into 'master'
Fix mass SQL statements during initial push of a big repository ## What does this MR do? This MR prevents `process_commit_messages(ref)` to be executed for the initial push to the default branch. Currently it is being executed which results in ~500000 SQL Statements during the import of the linux mainline repository. These statements check for references to issues/mrs in each commit. That usually doesn't make sense for the initial push, because there aren't any issues/mrs yet. This MR will reduce the load on gitlab servers in the coming months. Especially now that several importers are available for gitlab and projects are moving from gitorious to gitlab. See merge request !376
-rw-r--r--CHANGELOG1
-rw-r--r--app/services/git_push_service.rb4
-rw-r--r--spec/services/git_push_service_spec.rb9
3 files changed, 4 insertions, 10 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b8f95994213..588e645c69f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased)
+ - Fix mass SQL statements on initial push (Hannes Rosenögger)
- Add tag push notifications and normalize HipChat and Slack messages to be consistent (Stan Hu)
- Add comment notification events to HipChat and Slack services (Stan Hu)
- Add issue and merge request events to HipChat and Slack services (Stan Hu)
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 13def127763..4e1afea6d50 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -42,8 +42,10 @@ class GitPushService
# as a heuristic. This may include more commits than are actually pushed, but
# that shouldn't matter because we check for existing cross-references later.
@push_commits = project.repository.commits_between(project.default_branch, newrev)
+
+ # don't process commits for the initial push to the default branch
+ process_commit_messages(ref)
end
- process_commit_messages(ref)
elsif push_to_existing_branch?(ref, oldrev)
# Collect data for this git push
@push_commits = project.repository.commits_between(oldrev, newrev)
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index e264072b573..1b1e3ca5f8b 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -197,15 +197,6 @@ describe GitPushService do
service.execute(project, user, @blankrev, @newrev, 'refs/heads/other')
end
-
- it "finds references in the first push to a default branch" do
- allow(project.repository).to receive(:commits_between).with(@blankrev, @newrev).and_return([])
- allow(project.repository).to receive(:commits).with(@newrev).and_return([commit])
-
- expect(Note).to receive(:create_cross_reference_note).with(issue, commit, commit_author, project)
-
- service.execute(project, user, @blankrev, @newrev, 'refs/heads/master')
- end
end
describe "closing issues from pushed commits" do