Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
9dc7a119
Commit
9dc7a119
authored
Oct 05, 2016
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix short circuit logic between rsync with and without ionice for
storage migrations
parent
fad9498c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
CHANGELOG
CHANGELOG
+3
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+3
-1
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+35
-0
No files found.
CHANGELOG
View file @
9dc7a119
v3.6.4
- Fix short circuit logic between rsync with and without ionice for storage migrations
v3.6.3
- Re-exposing GL_ID to custom hooks
...
...
lib/gitlab_projects.rb
View file @
9dc7a119
...
...
@@ -321,7 +321,9 @@ class GitlabProjects
rsync_path
=
'ionice -c2 -n7 rsync'
result
=
system
(
*
%W(
#{
rsync_path
}
-a --delete --rsync-path="
#{
rsync_path
}
"
#{
source_path
}
#{
new_full_path
}
)
)
unless
result
if
result
true
else
# If the command fails with `ionice` (maybe because we're on a OS X
# development machine), try again without `ionice`.
rsync_path
=
'rsync'
...
...
spec/gitlab_projects_spec.rb
View file @
9dc7a119
...
...
@@ -227,6 +227,41 @@ describe GitlabProjects do
FileUtils
.
cd
(
new_repo_path
)
{
Dir
[
'**/*'
].
length
.
should_not
be
(
0
)
}
end
it
"should attempt rsync with ionice first"
do
expect
(
gl_projects
).
to
receive
(
:system
).
with
(
'ionice -c2 -n7 rsync'
,
'-a'
,
'--delete'
,
'--rsync-path="ionice -c2 -n7 rsync"'
,
"
#{
tmp_repo_path
}
/"
,
new_repo_path
).
and_return
(
true
)
gl_projects
.
exec
.
should
be_true
end
it
"should attempt rsync without ionice if with ionice fails"
do
expect
(
gl_projects
).
to
receive
(
:system
).
with
(
'ionice -c2 -n7 rsync'
,
'-a'
,
'--delete'
,
'--rsync-path="ionice -c2 -n7 rsync"'
,
"
#{
tmp_repo_path
}
/"
,
new_repo_path
).
and_return
(
false
)
expect
(
gl_projects
).
to
receive
(
:system
).
with
(
'rsync'
,
'-a'
,
'--delete'
,
'--rsync-path="rsync"'
,
"
#{
tmp_repo_path
}
/"
,
new_repo_path
).
and_return
(
true
)
gl_projects
.
exec
.
should
be_true
end
it
"should fail if both rsync attempts fail"
do
expect
(
gl_projects
).
to
receive
(
:system
).
with
(
'ionice -c2 -n7 rsync'
,
'-a'
,
'--delete'
,
'--rsync-path="ionice -c2 -n7 rsync"'
,
"
#{
tmp_repo_path
}
/"
,
new_repo_path
).
and_return
(
false
)
expect
(
gl_projects
).
to
receive
(
:system
).
with
(
'rsync'
,
'-a'
,
'--delete'
,
'--rsync-path="rsync"'
,
"
#{
tmp_repo_path
}
/"
,
new_repo_path
).
and_return
(
false
)
gl_projects
.
exec
.
should
be_false
end
it
"should fail if no destination path is provided"
do
incomplete
=
build_gitlab_projects
(
'mv-storage'
,
tmp_repos_path
,
repo_name
)
$logger
.
should_receive
(
:error
).
with
(
"mv-storage failed: no destination storage path provided."
)
...
...
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