summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-10-30 11:57:09 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2017-10-30 11:57:09 +0000
commitc14697a50bd6eba6782f594f86757e2978d54596 (patch)
tree1082a40ad887296f746ed410bdaedc5402ef9a80
parentf83f15b2aea292db3474074566896a429e1e79b3 (diff)
parentba9b4c4de86aa816e5ddc7a9cde9193c43835223 (diff)
downloadgitlab-ce-c14697a50bd6eba6782f594f86757e2978d54596.tar.gz
Merge branch '39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout' into 'master'
Resolve "ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR: canceling statement due to statement timeout" Closes #39054 See merge request gitlab-org/gitlab-ce!15063
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml5
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 07352db5d2d..d45b9c805a4 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -878,7 +878,7 @@ class MergeRequest < ActiveRecord::Base
#
def all_commit_shas
if persisted?
- column_shas = MergeRequestDiffCommit.where(merge_request_diff: merge_request_diffs).pluck('DISTINCT(sha)')
+ column_shas = MergeRequestDiffCommit.where(merge_request_diff: merge_request_diffs).limit(10_000).pluck('sha')
serialised_shas = merge_request_diffs.where.not(st_commits: nil).flat_map(&:commit_shas)
(column_shas + serialised_shas).uniq
diff --git a/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml b/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml
new file mode 100644
index 00000000000..47bf30ecb5a
--- /dev/null
+++ b/changelogs/unreleased/39054-activerecord-statementinvalid-pg-querycanceled-error-canceling-statement-due-to-statement-timeout.yml
@@ -0,0 +1,5 @@
+---
+title: Stop merge requests with thousands of commits from timing out
+merge_request: 15063
+author:
+type: performance