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
3a87bfb2
Commit
3a87bfb2
authored
Apr 02, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lock for delete
parent
0971f301
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+1
-1
lib/gitlab/ci/trace/chunked_file/chunked_io.rb
lib/gitlab/ci/trace/chunked_file/chunked_io.rb
+5
-1
lib/gitlab/ci/trace/chunked_file/concerns/permissions.rb
lib/gitlab/ci/trace/chunked_file/concerns/permissions.rb
+2
-1
lib/gitlab/ci/trace/chunked_file/live_trace.rb
lib/gitlab/ci/trace/chunked_file/live_trace.rb
+5
-1
No files found.
lib/gitlab/ci/trace.rb
View file @
3a87bfb2
...
...
@@ -110,7 +110,7 @@ module Gitlab
raise
ArchiveError
,
'Job is not finished yet'
unless
job
.
complete?
if
ChunkedFile
::
LiveTrace
.
exist?
(
job
.
id
)
ChunkedFile
::
LiveTrace
.
open
(
job
.
id
,
"wb"
)
do
|
stream
|
ChunkedFile
::
LiveTrace
.
open
(
job
.
id
,
'a+b'
)
do
|
stream
|
archive_stream!
(
stream
)
stream
.
delete
end
...
...
lib/gitlab/ci/trace/chunked_file/chunked_io.rb
View file @
3a87bfb2
...
...
@@ -128,7 +128,11 @@ module Gitlab
end
def
present?
true
chunk_store
.
chunks_count
(
job_id
)
>
0
end
def
delete
chunk_store
.
delete_all
end
private
...
...
lib/gitlab/ci/trace/chunked_file/concerns/permissions.rb
View file @
3a87bfb2
...
...
@@ -21,6 +21,7 @@ module Gitlab
# write_lock
before_method
:write
,
:check_lock!
before_method
:truncate
,
:check_lock!
before_method
:delete
,
:check_lock!
end
def
initialize
(
job_id
,
size
,
mode
=
'rb'
)
...
...
@@ -43,7 +44,7 @@ module Gitlab
end
def
check_lock!
raise
PermissionError
,
'Could not
writ
e without lock'
unless
write_lock_uuid
raise
PermissionError
,
'Could not
modify the fil
e without lock'
unless
write_lock_uuid
end
def
can_read!
...
...
lib/gitlab/ci/trace/chunked_file/live_trace.rb
View file @
3a87bfb2
...
...
@@ -29,7 +29,7 @@ module Gitlab
# Efficient process than iterating each
def
truncate
(
offset
)
if
truncate
==
0
self
.
delete_all
(
job_id
)
delete
elsif
offset
==
size
# no-op
else
...
...
@@ -37,6 +37,10 @@ module Gitlab
end
end
def
present?
self
.
exist?
(
job_id
)
end
def
delete
ChunkStores
::
Redis
.
delete_all
(
job_id
)
ChunkStores
::
Database
.
delete_all
(
job_id
)
...
...
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