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
Show 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
...
@@ -110,7 +110,7 @@ module Gitlab
raise
ArchiveError
,
'Job is not finished yet'
unless
job
.
complete?
raise
ArchiveError
,
'Job is not finished yet'
unless
job
.
complete?
if
ChunkedFile
::
LiveTrace
.
exist?
(
job
.
id
)
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
)
archive_stream!
(
stream
)
stream
.
delete
stream
.
delete
end
end
...
...
lib/gitlab/ci/trace/chunked_file/chunked_io.rb
View file @
3a87bfb2
...
@@ -128,7 +128,11 @@ module Gitlab
...
@@ -128,7 +128,11 @@ module Gitlab
end
end
def
present?
def
present?
true
chunk_store
.
chunks_count
(
job_id
)
>
0
end
def
delete
chunk_store
.
delete_all
end
end
private
private
...
...
lib/gitlab/ci/trace/chunked_file/concerns/permissions.rb
View file @
3a87bfb2
...
@@ -21,6 +21,7 @@ module Gitlab
...
@@ -21,6 +21,7 @@ module Gitlab
# write_lock
# write_lock
before_method
:write
,
:check_lock!
before_method
:write
,
:check_lock!
before_method
:truncate
,
:check_lock!
before_method
:truncate
,
:check_lock!
before_method
:delete
,
:check_lock!
end
end
def
initialize
(
job_id
,
size
,
mode
=
'rb'
)
def
initialize
(
job_id
,
size
,
mode
=
'rb'
)
...
@@ -43,7 +44,7 @@ module Gitlab
...
@@ -43,7 +44,7 @@ module Gitlab
end
end
def
check_lock!
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
end
def
can_read!
def
can_read!
...
...
lib/gitlab/ci/trace/chunked_file/live_trace.rb
View file @
3a87bfb2
...
@@ -29,7 +29,7 @@ module Gitlab
...
@@ -29,7 +29,7 @@ module Gitlab
# Efficient process than iterating each
# Efficient process than iterating each
def
truncate
(
offset
)
def
truncate
(
offset
)
if
truncate
==
0
if
truncate
==
0
self
.
delete_all
(
job_id
)
delete
elsif
offset
==
size
elsif
offset
==
size
# no-op
# no-op
else
else
...
@@ -37,6 +37,10 @@ module Gitlab
...
@@ -37,6 +37,10 @@ module Gitlab
end
end
end
end
def
present?
self
.
exist?
(
job_id
)
end
def
delete
def
delete
ChunkStores
::
Redis
.
delete_all
(
job_id
)
ChunkStores
::
Redis
.
delete_all
(
job_id
)
ChunkStores
::
Database
.
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