Commit d7c35163 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend exception about chunk data not fulfilled in a bucket

This commit extends exception raised when a chunk can not be migrated to
an object store. It will help to understand why this problem happens
sometimes.
parent 4553557a
......@@ -140,8 +140,7 @@ module Ci
# no chunk with higher index in the database.
#
def final?
build.pending_state.present? &&
build.trace_chunks.maximum(:chunk_index).to_i == chunk_index
build.pending_state.present? && chunks_max_index == chunk_index
end
def <=>(other)
......@@ -165,7 +164,14 @@ module Ci
current_size = current_data&.bytesize.to_i
unless current_size == CHUNK_SIZE || final?
raise FailedToPersistDataError, 'Data is not fulfilled in a bucket'
raise FailedToPersistDataError, <<~MSG
data is not fulfilled in a bucket
size: #{current_size}
state: #{build.pending_state.present?}
max: #{chunks_max_index}
index: #{chunk_index}
MSG
end
self.raw_data = nil
......@@ -223,6 +229,10 @@ module Ci
self.class.get_store_class(data_store)
end
def chunks_max_index
build.trace_chunks.maximum(:chunk_index).to_i
end
def lock_params
["trace_write:#{build_id}:chunks:#{chunk_index}",
{ ttl: WRITE_LOCK_TTL,
......
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