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
2709ff73
Commit
2709ff73
authored
Jul 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
60ab1d74
ddf2dcf7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
22 deletions
+27
-22
lib/gitlab/git/rugged_impl/blob.rb
lib/gitlab/git/rugged_impl/blob.rb
+1
-1
lib/gitlab/git/rugged_impl/commit.rb
lib/gitlab/git/rugged_impl/commit.rb
+3
-3
lib/gitlab/git/rugged_impl/repository.rb
lib/gitlab/git/rugged_impl/repository.rb
+1
-1
lib/gitlab/git/rugged_impl/tree.rb
lib/gitlab/git/rugged_impl/tree.rb
+1
-1
lib/gitlab/git/rugged_impl/use_rugged.rb
lib/gitlab/git/rugged_impl/use_rugged.rb
+6
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+12
-13
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
+0
-1
spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
+1
-2
spec/spec_helper.rb
spec/spec_helper.rb
+2
-0
No files found.
lib/gitlab/git/rugged_impl/blob.rb
View file @
2709ff73
...
...
@@ -16,7 +16,7 @@ module Gitlab
override
:tree_entry
def
tree_entry
(
repository
,
sha
,
path
,
limit
)
if
use_rugged?
(
repository
,
:rugged_tree_entry
)
rugged_tree_entry
(
repository
,
sha
,
path
,
limit
)
wrap_rugged_call
{
rugged_tree_entry
(
repository
,
sha
,
path
,
limit
)
}
else
super
end
...
...
lib/gitlab/git/rugged_impl/commit.rb
View file @
2709ff73
...
...
@@ -36,7 +36,7 @@ module Gitlab
override
:find_commit
def
find_commit
(
repo
,
commit_id
)
if
use_rugged?
(
repo
,
:rugged_find_commit
)
rugged_find
(
repo
,
commit_id
)
wrap_rugged_call
{
rugged_find
(
repo
,
commit_id
)
}
else
super
end
...
...
@@ -45,7 +45,7 @@ module Gitlab
override
:batch_by_oid
def
batch_by_oid
(
repo
,
oids
)
if
use_rugged?
(
repo
,
:rugged_list_commits_by_oid
)
rugged_batch_by_oid
(
repo
,
oids
)
wrap_rugged_call
{
rugged_batch_by_oid
(
repo
,
oids
)
}
else
super
end
...
...
@@ -68,7 +68,7 @@ module Gitlab
override
:commit_tree_entry
def
commit_tree_entry
(
path
)
if
use_rugged?
(
@repository
,
:rugged_commit_tree_entry
)
rugged_tree_entry
(
path
)
wrap_rugged_call
{
rugged_tree_entry
(
path
)
}
else
super
end
...
...
lib/gitlab/git/rugged_impl/repository.rb
View file @
2709ff73
...
...
@@ -48,7 +48,7 @@ module Gitlab
override
:ancestor?
def
ancestor?
(
from
,
to
)
if
use_rugged?
(
self
,
:rugged_commit_is_ancestor
)
rugged_is_ancestor?
(
from
,
to
)
wrap_rugged_call
{
rugged_is_ancestor?
(
from
,
to
)
}
else
super
end
...
...
lib/gitlab/git/rugged_impl/tree.rb
View file @
2709ff73
...
...
@@ -16,7 +16,7 @@ module Gitlab
override
:tree_entries
def
tree_entries
(
repository
,
sha
,
path
,
recursive
)
if
use_rugged?
(
repository
,
:rugged_tree_entries
)
tree_entries_with_flat_path_from_rugged
(
repository
,
sha
,
path
,
recursive
)
wrap_rugged_call
{
tree_entries_with_flat_path_from_rugged
(
repository
,
sha
,
path
,
recursive
)
}
else
super
end
...
...
lib/gitlab/git/rugged_impl/use_rugged.rb
View file @
2709ff73
...
...
@@ -10,6 +10,12 @@ module Gitlab
Gitlab
::
GitalyClient
.
can_use_disk?
(
repo
.
storage
)
end
def
wrap_rugged_call
(
&
block
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
yield
end
end
end
end
end
...
...
lib/gitlab/gitaly_client.rb
View file @
2709ff73
...
...
@@ -387,21 +387,20 @@ module Gitlab
end
def
self
.
can_use_disk?
(
storage
)
false
# cached_value = MUTEX.synchronize do
# @can_use_disk ||= {}
# @can_use_disk[storage]
# end
cached_value
=
MUTEX
.
synchronize
do
@can_use_disk
||=
{}
@can_use_disk
[
storage
]
end
# return cached_value unless cached_value.nil
?
return
cached_value
if
cached_value
.
present
?
#
gitaly_filesystem_id = filesystem_id(storage)
#
direct_filesystem_id = filesystem_id_from_disk(storage)
gitaly_filesystem_id
=
filesystem_id
(
storage
)
direct_filesystem_id
=
filesystem_id_from_disk
(
storage
)
#
MUTEX.synchronize do
#
@can_use_disk[storage] = gitaly_filesystem_id.present? &&
#
gitaly_filesystem_id == direct_filesystem_id
#
end
MUTEX
.
synchronize
do
@can_use_disk
[
storage
]
=
gitaly_filesystem_id
.
present?
&&
gitaly_filesystem_id
==
direct_filesystem_id
end
end
def
self
.
filesystem_id
(
storage
)
...
...
@@ -414,7 +413,7 @@ module Gitlab
metadata_file
=
File
.
read
(
storage_metadata_file_path
(
storage
))
metadata_hash
=
JSON
.
parse
(
metadata_file
)
metadata_hash
[
'gitaly_filesystem_id'
]
rescue
Errno
::
ENOENT
,
JSON
::
ParserError
rescue
Errno
::
ENOENT
,
Errno
::
ACCESS
,
JSON
::
ParserError
nil
end
...
...
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
View file @
2709ff73
...
...
@@ -26,7 +26,6 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
end
it
'loads 10 projects without hitting Gitaly call limit'
,
:request_store
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:can_access_disk?
).
and_return
(
false
)
projects
=
Gitlab
::
GitalyClient
.
allow_n_plus_1_calls
do
(
1
..
10
).
map
{
create
(
:project
,
:repository
)
}
end
...
...
spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
View file @
2709ff73
...
...
@@ -21,6 +21,7 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do
end
before
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:can_use_disk?
).
and_call_original
Gitlab
::
GitalyClient
.
instance_variable_set
(
:@can_use_disk
,
{})
end
...
...
@@ -30,7 +31,6 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do
end
it
'returns true when gitaly matches disk'
do
pending
(
'temporary disabled because of https://gitlab.com/gitlab-org/gitlab-ce/issues/64338'
)
expect
(
subject
.
use_rugged?
(
repository
,
feature_flag_name
)).
to
be
true
end
...
...
@@ -49,7 +49,6 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do
end
it
"doesn't lead to a second rpc call because gitaly client should use the cached value"
do
pending
(
'temporary disabled because of https://gitlab.com/gitlab-org/gitlab-ce/issues/64338'
)
expect
(
subject
.
use_rugged?
(
repository
,
feature_flag_name
)).
to
be
true
expect
(
Gitlab
::
GitalyClient
).
not_to
receive
(
:filesystem_id
)
...
...
spec/spec_helper.rb
View file @
2709ff73
...
...
@@ -136,6 +136,8 @@ RSpec.configure do |config|
allow
(
Feature
).
to
receive
(
:enabled?
).
with
(
flag
).
and_return
(
enabled
)
end
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:can_use_disk?
).
and_return
(
enabled
)
# The following can be removed when we remove the staged rollout strategy
# and we can just enable it using instance wide settings
# (ie. ApplicationSetting#auto_devops_enabled)
...
...
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