Commit c30f4421 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve exceptions messages in code creating stages

parent 708059bd
...@@ -28,9 +28,11 @@ module Ci ...@@ -28,9 +28,11 @@ module Ci
find_stage || create_stage find_stage || create_stage
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
retry if (attempts -= 1) > 0 retry if (attempts -= 1) > 0
raise EnsureStageError, <<~EOS raise EnsureStageError, <<~EOS
Possible bug in the database load balancing detected! We failed to find or create a unique pipeline stage after 2 retries.
Please fix me! This should never happen and is most likely the result of a bug in
the database load balancing code.
EOS EOS
end end
......
...@@ -11,9 +11,12 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration ...@@ -11,9 +11,12 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration
add_unique_index! add_unique_index!
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
retry if (attempts -= 1) > 0 retry if (attempts -= 1) > 0
raise StandardError, <<~EOS raise StandardError, <<~EOS
Failed to add an unique index to ci_stages, despite retrying the 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 EOS
end 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