summaryrefslogtreecommitdiff
path: root/app/models/ci/build_trace_chunk.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-14 12:08:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-14 12:08:58 +0000
commitc9ca178ba4c9a3e48d9d069f7d7486a29827cc61 (patch)
tree07a4f84921b80ff967d30229f0d887c152b9b1d8 /app/models/ci/build_trace_chunk.rb
parent6035fcc36ead3b415fa2422b0204a795a70f3e2f (diff)
downloadgitlab-ce-c9ca178ba4c9a3e48d9d069f7d7486a29827cc61.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci/build_trace_chunk.rb')
-rw-r--r--app/models/ci/build_trace_chunk.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb
index 5fabed8feec..6926ccd9438 100644
--- a/app/models/ci/build_trace_chunk.rb
+++ b/app/models/ci/build_trace_chunk.rb
@@ -136,6 +136,10 @@ module Ci
# We are using optimistic locking combined with Redis locking to ensure
# that a chunk gets migrated properly.
#
+ # We are catching an exception related to an exclusive lock not being
+ # acquired because it is creating a lot of noise, and is a result of
+ # duplicated workers running in parallel for the same build trace chunk.
+ #
def persist_data!
in_lock(*lock_params) do # exclusive Redis lock is acquired first
raise FailedToPersistDataError, 'Modifed build trace chunk detected' if has_changes_to_save?
@@ -144,6 +148,8 @@ module Ci
chunk.unsafe_persist_data! # we migrate the data and update data store
end
end
+ rescue FailedToObtainLockError
+ metrics.increment_trace_operation(operation: :stalled)
rescue ActiveRecord::StaleObjectError
raise FailedToPersistDataError, <<~MSG
Data migration race condition detected