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
86527290
Commit
86527290
authored
Aug 20, 2020
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap rails code in concurrent backups
Rails needs these extra blocks to prevent internal race conditions
parent
f2c27366
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
15 deletions
+28
-15
changelogs/unreleased/backup_wrap_concurrency.yml
changelogs/unreleased/backup_wrap_concurrency.yml
+5
-0
lib/backup/repository.rb
lib/backup/repository.rb
+23
-15
No files found.
changelogs/unreleased/backup_wrap_concurrency.yml
0 → 100644
View file @
86527290
---
title
:
Fix race condition in concurrent backups
merge_request
:
39894
author
:
type
:
fixed
lib/backup/repository.rb
View file @
86527290
...
...
@@ -26,13 +26,17 @@ module Backup
threads
=
Gitlab
.
config
.
repositories
.
storages
.
keys
.
map
do
|
storage
|
Thread
.
new
do
dump_storage
(
storage
,
semaphore
,
max_storage_concurrency:
max_storage_concurrency
)
rescue
=>
e
errors
<<
e
Rails
.
application
.
executor
.
wrap
do
dump_storage
(
storage
,
semaphore
,
max_storage_concurrency:
max_storage_concurrency
)
rescue
=>
e
errors
<<
e
end
end
end
threads
.
each
(
&
:join
)
ActiveSupport
::
Dependencies
.
interlock
.
permit_concurrent_loads
do
threads
.
each
(
&
:join
)
end
raise
errors
.
pop
unless
errors
.
empty?
end
...
...
@@ -155,16 +159,18 @@ module Backup
threads
=
Array
.
new
(
max_storage_concurrency
)
do
Thread
.
new
do
while
project
=
queue
.
pop
semaphore
.
acquire
begin
dump_project
(
project
)
rescue
=>
e
errors
<<
e
break
ensure
semaphore
.
release
Rails
.
application
.
executor
.
wrap
do
while
project
=
queue
.
pop
semaphore
.
acquire
begin
dump_project
(
project
)
rescue
=>
e
errors
<<
e
break
ensure
semaphore
.
release
end
end
end
end
...
...
@@ -177,7 +183,9 @@ module Backup
end
queue
.
close
threads
.
each
(
&
:join
)
ActiveSupport
::
Dependencies
.
interlock
.
permit_concurrent_loads
do
threads
.
each
(
&
:join
)
end
raise
errors
.
pop
unless
errors
.
empty?
end
...
...
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