BigW Consortium Gitlab

Commit 645b404d by Shinya Maeda

Fix specs. Align with the new table name ci_build_trace_chunk

parent 1fb66181
......@@ -19,18 +19,13 @@ module Ci
has_one :last_deployment, -> { order('deployments.id DESC') }, as: :deployable, class_name: 'Deployment'
has_many :trace_sections, class_name: 'Ci::BuildTraceSection'
has_many :trace_chunks, class_name: 'Ci::BuildTraceChunk', foreign_key: :build_id, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :trace_chunks, class_name: 'Ci::BuildTraceChunk', foreign_key: :build_id
has_many :job_artifacts, class_name: 'Ci::JobArtifact', foreign_key: :job_id, dependent: :destroy, inverse_of: :job # rubocop:disable Cop/ActiveRecordDependent
has_one :job_artifacts_archive, -> { where(file_type: Ci::JobArtifact.file_types[:archive]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
has_one :job_artifacts_metadata, -> { where(file_type: Ci::JobArtifact.file_types[:metadata]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
has_one :job_artifacts_trace, -> { where(file_type: Ci::JobArtifact.file_types[:trace]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
<<<<<<< HEAD
has_many :chunks, class_name: 'Ci::JobTraceChunk', foreign_key: :job_id
=======
>>>>>>> live-trace-v2
has_one :metadata, class_name: 'Ci::BuildMetadata'
delegate :timeout, to: :metadata, prefix: true, allow_nil: true
delegate :gitlab_deploy_token, to: :project
......
......@@ -19,9 +19,8 @@ module Ci
db: 2
}
<<<<<<< HEAD:app/models/ci/job_trace_chunk.rb
def self.delayed_cleanup_blk
ids = all.redis.pluck(:job_id, :chunk_index).map do |data|
ids = all.redis.pluck(:build_id, :chunk_index).map do |data|
"gitlab:ci:trace:#{data.first}:chunks:#{data.second}:data"
end
......@@ -44,10 +43,8 @@ module Ci
end
end
=======
##
# Data is memoized for optimizing #size and #end_offset
>>>>>>> live-trace-v2:app/models/ci/build_trace_chunk.rb
def data
@data ||= get_data
end
......
......@@ -228,7 +228,7 @@ class Project < ActiveRecord::Base
# still using `dependent: :destroy` here.
has_many :builds, class_name: 'Ci::Build', inverse_of: :project, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :build_trace_section_names, class_name: 'Ci::BuildTraceSectionName'
has_many :build_trace_chunks, class_name: 'Ci::JobTraceChunk', foreign_key: :job_id, through: :builds, source: :chunks
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks
has_many :runner_projects, class_name: 'Ci::RunnerProject'
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
has_many :variables, class_name: 'Ci::Variable'
......
......@@ -8,7 +8,7 @@ class BuildFinishedWorker
Ci::Build.find_by(id: build_id).try do |build|
# Swap all trace chunks to Database from Redis
# TODO: Do we need that?
build.chunks.redis.map(&:use_database!)
build.trace_chunks.redis.map(&:use_database!)
# We execute that in sync as this access the files in order to access local data, and reduce IO
BuildTraceSectionsWorker.new.perform(build.id)
......
......@@ -111,7 +111,7 @@ module Gitlab
if job.trace_chunks.any?
Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream|
archive_stream!(stream)
stream.delete!
stream.destroy!
end
elsif current_path
File.open(current_path) do |stream|
......
......@@ -276,6 +276,7 @@ project:
- uploads
- members_and_requesters
- build_trace_section_names
- build_trace_chunks
- root_of_fork_network
- fork_network_member
- fork_network
......
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