Commit c30f4421 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve exceptions messages in code creating stages

parent 708059bd
Pipeline #17153300 failed with stages
in 31 minutes and 36 seconds
......@@ -28,9 +28,11 @@ module Ci
find_stage || create_stage
rescue ActiveRecord::RecordNotUnique
retry if (attempts -= 1) > 0
raise EnsureStageError, <<~EOS
Possible bug in the database load balancing detected!
Please fix me!
We failed to find or create a unique pipeline stage after 2 retries.
This should never happen and is most likely the result of a bug in
the database load balancing code.
EOS
end
......
......@@ -11,9 +11,12 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration
add_unique_index!
rescue ActiveRecord::RecordNotUnique
retry if (attempts -= 1) > 0
raise StandardError, <<~EOS
Failed to add an unique index to ci_stages, despite retrying the
migration 100 times. See gitlab-org/gitlab-ce!16580.
migration 100 times.
See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/16580.
EOS
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment