summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-06 14:16:12 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-06 14:16:12 +0100
commitc30f4421749efc08051436496f2aec3269132412 (patch)
treea7ab34f785318f4efcb0cba8061d6cd40a5abcfd
parent708059bd9a8f6509b95f7d63c69ce4106d23d6a0 (diff)
downloadgitlab-ce-c30f4421749efc08051436496f2aec3269132412.tar.gz
Improve exceptions messages in code creating stages
-rw-r--r--app/services/ci/ensure_stage_service.rb6
-rw-r--r--db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb5
2 files changed, 8 insertions, 3 deletions
diff --git a/app/services/ci/ensure_stage_service.rb b/app/services/ci/ensure_stage_service.rb
index 775b3668c1d..87f19b333de 100644
--- a/app/services/ci/ensure_stage_service.rb
+++ b/app/services/ci/ensure_stage_service.rb
@@ -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
diff --git a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb b/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
index 6783b717543..d896bb52347 100644
--- a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
+++ b/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
@@ -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