diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-10 09:08:55 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-10 09:08:55 +0000 |
commit | a2344dbf1942dc3919c55b0684d2566368e03852 (patch) | |
tree | 00f92dc8b5e2e2cb732662f5e5e0ffd5f3d2eca0 /app/services/ci/pipelines/add_job_service.rb | |
parent | 213da19cda5309148952ab770e2a9e122fe32e22 (diff) | |
download | gitlab-ce-a2344dbf1942dc3919c55b0684d2566368e03852.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/ci/pipelines/add_job_service.rb')
-rw-r--r-- | app/services/ci/pipelines/add_job_service.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/ci/pipelines/add_job_service.rb b/app/services/ci/pipelines/add_job_service.rb index dfbb37cf0dc..1a5c8d0dccf 100644 --- a/app/services/ci/pipelines/add_job_service.rb +++ b/app/services/ci/pipelines/add_job_service.rb @@ -18,6 +18,12 @@ module Ci in_lock("ci:pipelines:#{pipeline.id}:add-job", ttl: LOCK_TIMEOUT, sleep_sec: LOCK_SLEEP, retries: LOCK_RETRIES) do Ci::Pipeline.transaction do + # This is used to reduce the deadlocks when partitioning `ci_builds` + # since inserting into this table requires locks on all foreign keys + # and we need to lock all the tables in a specific order for the + # migration to succeed. + Ci::Pipeline.connection.execute('LOCK "ci_pipelines", "ci_stages" IN ROW SHARE MODE;') + yield(job) job.update_older_statuses_retried! |