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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1899e9a2
Commit
1899e9a2
authored
Jan 15, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
342bcc72
11d6c7e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
app/uploaders/records_uploads.rb
app/uploaders/records_uploads.rb
+15
-5
No files found.
app/uploaders/records_uploads.rb
View file @
1899e9a2
...
...
@@ -23,13 +23,23 @@ module RecordsUploads
return
unless
model
return
unless
file
&&
file
.
exists?
Upload
.
transaction
do
uploads
.
where
(
path:
upload_path
).
delete_all
upload
.
delete
if
upload
self
.
upload
=
build_upload
.
tap
(
&
:save!
)
# MySQL InnoDB may encounter a deadlock if a deletion and an
# insert is in the same transaction due to its next-key locking
# algorithm, so we need to skip the transaction.
# https://gitlab.com/gitlab-org/gitlab-ce/issues/55161#note_131556351
if
Gitlab
::
Database
.
mysql?
readd_upload
else
Upload
.
transaction
{
readd_upload
}
end
end
def
readd_upload
uploads
.
where
(
path:
upload_path
).
delete_all
upload
.
delete
if
upload
self
.
upload
=
build_upload
.
tap
(
&
:save!
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
upload_path
...
...
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