Skip to content
Snippets Groups Projects

Prevent Gitaly storages from using the same path

Merged Will Chandler (ex-GitLab) requested to merge wc/no-dup-gitaly-storages into master
1 unresolved thread
2 files
+ 61
0
Compare changes
  • Side-by-side
  • Inline
Files
2
  • Gitaly is making a breaking change with v17.0 to prevent multiple
    storages from sharing the same local path. This is being done as part of
    the work to add a write-ahead log to Gitaly, see
    gitaly#5598 for further details.
    
    Validate that Gitaly's config does not have than one storage using the
    same path, dereferencing any symlinks.
    
    Changelog: changed
@@ -27,6 +27,7 @@ module Gitaly
parse_git_data_dirs
parse_gitaly_storages
parse_gitconfig
check_duplicate_storage_paths
end
def gitaly_address
@@ -160,6 +161,28 @@ module Gitaly
Chef::Mixin::DeepMerge.deep_merge!(tmp_source_hash, Gitlab['gitaly'])
end
# Validate that no storages are sharing the same path.
def check_duplicate_storage_paths
storages = Gitlab['gitaly']['configuration']['storage']
real_paths = storages.group_by do |stor|
path = stor[:path]
begin
File.realpath(path)
rescue Errno::ENOENT
path
end
end
duplicate_paths = real_paths.select { |_, stors| stors.length > 1 }
return if duplicate_paths.empty?
duplicate_paths.transform_values! { |stors| stors.map { |stor| stor[:name] } }
output = duplicate_paths.map { |path, names| "#{path}: #{names.join(', ')}" }
raise "More than one Gitaly storage assigned to the same path:\n #{output.join('\n ')}"
end
private
def user_config
Loading