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
e1ab98ac
Commit
e1ab98ac
authored
Apr 02, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
ae36c7b0
4ca1c51e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
19 deletions
+6
-19
app/models/pool_repository.rb
app/models/pool_repository.rb
+1
-4
app/models/project.rb
app/models/project.rb
+1
-1
lib/gitlab/git/object_pool.rb
lib/gitlab/git/object_pool.rb
+1
-1
lib/gitlab/gitaly_client/object_pool_service.rb
lib/gitlab/gitaly_client/object_pool_service.rb
+0
-10
spec/models/pool_repository_spec.rb
spec/models/pool_repository_spec.rb
+3
-3
No files found.
app/models/pool_repository.rb
View file @
e1ab98ac
...
...
@@ -81,10 +81,7 @@ class PoolRepository < ApplicationRecord
object_pool
.
link
(
repository
.
raw
)
end
# This RPC can cause data loss, as not all objects are present the local repository
def
unlink_repository
(
repository
)
object_pool
.
unlink_repository
(
repository
.
raw
)
def
mark_obsolete_if_last
(
repository
)
if
member_projects
.
where
.
not
(
id:
repository
.
project
.
id
).
exists?
true
else
...
...
app/models/project.rb
View file @
e1ab98ac
...
...
@@ -2128,7 +2128,7 @@ class Project < ApplicationRecord
end
def
leave_pool_repository
pool_repository
&
.
unlink_repository
(
repository
)
&&
update_column
(
:pool_repository_id
,
nil
)
pool_repository
&
.
mark_obsolete_if_last
(
repository
)
&&
update_column
(
:pool_repository_id
,
nil
)
end
def
link_pool_repository
...
...
lib/gitlab/git/object_pool.rb
View file @
e1ab98ac
...
...
@@ -8,7 +8,7 @@ module Gitlab
GL_REPOSITORY
=
""
delegate
:exists?
,
:size
,
to: :repository
delegate
:
unlink_repository
,
:
delete
,
to: :object_pool_service
delegate
:delete
,
to: :object_pool_service
attr_reader
:storage
,
:relative_path
,
:source_repository
,
:gl_project_path
...
...
lib/gitlab/gitaly_client/object_pool_service.rb
View file @
e1ab98ac
...
...
@@ -33,16 +33,6 @@ module Gitlab
GitalyClient
.
call
(
storage
,
:object_pool_service
,
:link_repository_to_object_pool
,
request
,
timeout:
GitalyClient
.
fast_timeout
)
end
def
unlink_repository
(
repository
)
request
=
Gitaly
::
UnlinkRepositoryFromObjectPoolRequest
.
new
(
object_pool:
object_pool
,
repository:
repository
.
gitaly_repository
)
GitalyClient
.
call
(
storage
,
:object_pool_service
,
:unlink_repository_from_object_pool
,
request
,
timeout:
GitalyClient
.
fast_timeout
)
end
end
end
end
spec/models/pool_repository_spec.rb
View file @
e1ab98ac
...
...
@@ -24,14 +24,14 @@ describe PoolRepository do
end
end
describe
'#
unlink_repository
'
do
describe
'#
mark_obsolete_if_last
'
do
let
(
:pool
)
{
create
(
:pool_repository
,
:ready
)
}
context
'when the last member leaves'
do
it
'schedules pool removal'
do
expect
(
::
ObjectPool
::
DestroyWorker
).
to
receive
(
:perform_async
).
with
(
pool
.
id
).
and_call_original
pool
.
unlink_repository
(
pool
.
source_project
.
repository
)
pool
.
mark_obsolete_if_last
(
pool
.
source_project
.
repository
)
end
end
...
...
@@ -40,7 +40,7 @@ describe PoolRepository do
create
(
:project
,
:repository
,
pool_repository:
pool
)
expect
(
::
ObjectPool
::
DestroyWorker
).
not_to
receive
(
:perform_async
).
with
(
pool
.
id
)
pool
.
unlink_repository
(
pool
.
source_project
.
repository
)
pool
.
mark_obsolete_if_last
(
pool
.
source_project
.
repository
)
end
end
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