Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
94ce2233
Commit
94ce2233
authored
Apr 24, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swap redis chunks when build finished
parent
fd8a63f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
9 deletions
+10
-9
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/ci/job_trace_chunk.rb
app/models/ci/job_trace_chunk.rb
+0
-2
app/workers/build_finished_worker.rb
app/workers/build_finished_worker.rb
+4
-1
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+2
-2
lib/gitlab/ci/trace/chunked_io.rb
lib/gitlab/ci/trace/chunked_io.rb
+3
-3
No files found.
app/models/ci/build.rb
View file @
94ce2233
...
...
@@ -25,7 +25,7 @@ module Ci
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
has_many
:chunks
,
class_name:
'Ci::JobTraceChunk'
,
foreign_key: :job_id
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:chunks
,
class_name:
'Ci::JobTraceChunk'
,
foreign_key: :job_id
has_one
:metadata
,
class_name:
'Ci::BuildMetadata'
delegate
:timeout
,
to: :metadata
,
prefix:
true
,
allow_nil:
true
...
...
app/models/ci/job_trace_chunk.rb
View file @
94ce2233
...
...
@@ -4,8 +4,6 @@ module Ci
belongs_to
:job
,
class_name:
"Ci::Build"
,
foreign_key: :job_id
after_destroy
:redis_delete_data
,
if: :redis?
default_value_for
:data_store
,
:redis
WriteError
=
Class
.
new
(
StandardError
)
...
...
app/workers/build_finished_worker.rb
View file @
94ce2233
...
...
@@ -6,7 +6,10 @@ class BuildFinishedWorker
def
perform
(
build_id
)
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
# We execute that in sync as this access the files in order to access local file, and reduce IO
# Swap all trace chunks to Database from Redis
build
.
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
)
BuildCoverageWorker
.
new
.
perform
(
build
.
id
)
...
...
lib/gitlab/ci/trace.rb
View file @
94ce2233
...
...
@@ -100,7 +100,7 @@ module Gitlab
FileUtils
.
rm
(
trace_path
,
force:
true
)
end
job
.
chunks
.
de
stroy
_all
job
.
chunks
.
de
lete
_all
job
.
erase_old_trace!
end
...
...
@@ -111,7 +111,7 @@ module Gitlab
if
job
.
chunks
.
any?
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
archive_stream!
(
stream
)
stream
.
de
stroy
!
stream
.
de
lete
!
end
elsif
current_path
File
.
open
(
current_path
)
do
|
stream
|
...
...
lib/gitlab/ci/trace/chunked_io.rb
View file @
94ce2233
...
...
@@ -140,7 +140,7 @@ module Gitlab
@size
=
offset
# remove all next chunks
job_chunks
.
where
(
'chunk_index > ?'
,
chunk_index
).
de
stroy
_all
job_chunks
.
where
(
'chunk_index > ?'
,
chunk_index
).
de
lete
_all
# truncate current chunk
current_chunk
.
truncate
(
chunk_offset
)
if
chunk_offset
!=
0
...
...
@@ -156,8 +156,8 @@ module Gitlab
true
end
def
de
stroy
!
job_chunks
.
de
stroy
_all
def
de
lete
!
job_chunks
.
de
lete
_all
@tell
=
@size
=
0
ensure
invalidate_chunk_cache
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment