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
e26bb072
Commit
e26bb072
authored
Jun 04, 2018
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove use of a shard's path (legacy_disk_path)
parent
ce902b95
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
28 deletions
+15
-28
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+1
-8
ee/app/models/storage_shard.rb
ee/app/models/storage_shard.rb
+4
-5
ee/app/serializers/storage_shard_entity.rb
ee/app/serializers/storage_shard_entity.rb
+1
-1
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
+0
-1
ee/spec/models/geo_node_status_spec.rb
ee/spec/models/geo_node_status_spec.rb
+0
-12
ee/spec/models/storage_shard_spec.rb
ee/spec/models/storage_shard_spec.rb
+0
-1
ee/spec/serializers/storage_shard_entity_spec.rb
ee/spec/serializers/storage_shard_entity_spec.rb
+9
-0
No files found.
ee/app/models/geo_node_status.rb
View file @
e26bb072
...
...
@@ -332,14 +332,7 @@ class GeoNodeStatus < ActiveRecord::Base
end
def
shards_match?
(
first
,
second
)
# Developers may want to run Geo locally using different paths
return
names_match?
(
first
,
second
)
if
Rails
.
env
.
development?
sort_by_name
(
first
)
==
sort_by_name
(
second
)
end
def
sort_by_name
(
shards
)
shards
.
sort_by
{
|
shard
|
shard
[
'name'
]
}
names_match?
(
first
,
second
)
end
def
names_match?
(
first
,
second
)
...
...
ee/app/models/storage_shard.rb
View file @
e26bb072
...
...
@@ -4,26 +4,25 @@
class
StorageShard
include
ActiveModel
::
Model
attr_accessor
:name
,
:path
attr_accessor
:name
validates
:name
,
presence:
true
validates
:path
,
presence:
true
# Generates an array of StorageShard objects from the currrent storage
# configuration using the gitlab.yml array of key/value pairs:
#
# {"default"=>{"
path"=>"/home/git/repositories
", ...}
# {"default"=>{"
gitaly_address"=>"/home/gitaly/gitaly.socket
", ...}
#
# The key is the shard name, and the values are the parameters for that shard.
def
self
.
all
Settings
.
repositories
.
storages
.
map
do
|
name
,
params
|
config
=
params
.
symbolize_keys
.
merge
(
name:
name
,
path:
params
.
legacy_disk_path
)
config
=
params
.
symbolize_keys
.
merge
(
name:
name
)
config
.
slice!
(
*
allowed_params
)
StorageShard
.
new
(
config
)
end
end
def
self
.
allowed_params
%i(name
path
)
.
freeze
%i(name)
.
freeze
end
end
ee/app/serializers/storage_shard_entity.rb
View file @
e26bb072
class
StorageShardEntity
<
Grape
::
Entity
expose
:name
,
:path
expose
:name
end
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
View file @
e26bb072
...
...
@@ -124,7 +124,6 @@ describe EE::API::Entities::GeoNodeStatus, :postgresql do
expect
(
subject
[
:storage_shards
].
count
).
to
eq
(
shards
.
count
)
expect
(
subject
[
:storage_shards
].
first
[
:name
]).
to
eq
(
shards
.
first
.
name
)
expect
(
subject
[
:storage_shards
].
first
[
:path
]).
to
eq
(
shards
.
first
.
path
)
end
end
...
...
ee/spec/models/geo_node_status_spec.rb
View file @
e26bb072
...
...
@@ -867,17 +867,5 @@ describe GeoNodeStatus, :geo do
expect
(
result
.
storage_shards_match?
).
to
be
true
end
context
'in development mode'
do
before
do
allow
(
Rails
.
env
).
to
receive
(
:development?
).
and_return
(
true
)
end
it
'returns true if keys are same but paths are different'
do
data
[
'storage_shards'
].
first
[
'path'
]
=
'/tmp/different-path'
expect
(
result
.
storage_shards_match?
).
to
be_truthy
end
end
end
end
ee/spec/models/storage_shard_spec.rb
View file @
e26bb072
...
...
@@ -7,7 +7,6 @@ describe StorageShard do
expect
(
shards
.
count
).
to
eq
(
Settings
.
repositories
.
storages
.
count
)
expect
(
shards
.
map
(
&
:name
)).
to
match_array
(
Settings
.
repositories
.
storages
.
keys
)
expect
(
shards
.
map
(
&
:path
)).
to
match_array
(
Settings
.
repositories
.
storages
.
values
.
map
(
&
:legacy_disk_path
))
end
end
end
ee/spec/serializers/storage_shard_entity_spec.rb
0 → 100644
View file @
e26bb072
require
'spec_helper'
describe
StorageShardEntity
,
:postgresql
do
let
(
:entity
)
{
described_class
.
new
(
StorageShard
.
new
,
request:
double
)
}
subject
{
entity
.
as_json
}
it
{
is_expected
.
to
have_key
(
:name
)
}
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