Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-10-11 14:35:20 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-10-15 11:59:18 +0300
commit50b968e886105096edf17a9a003658f27555180a (patch)
tree7ad3c665de3e4ee426ddfd56f4877aad27ebccf5 /internal/praefect/router_per_repository.go
parenta27584d74cf557aca5b659066560f02bfe4d5f32 (diff)
Get host assignment by repository ID
Praefect's routing should use repository ID consistently in all of the queries in order to avoid races where the external key of the repository changes between the various queries. This commit updates GetHostAssignments to get assignments by the repository's ID rather than its virtual storage and relative path.
Diffstat (limited to 'internal/praefect/router_per_repository.go')
-rw-r--r--internal/praefect/router_per_repository.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/praefect/router_per_repository.go b/internal/praefect/router_per_repository.go
index 431406acb..e3455c3a9 100644
--- a/internal/praefect/router_per_repository.go
+++ b/internal/praefect/router_per_repository.go
@@ -25,7 +25,7 @@ var errPrimaryUnassigned = errors.New("primary node is not assigned")
type AssignmentGetter interface {
// GetHostAssignments returns the names of the storages assigned to host the repository.
// The primary node must always be assigned.
- GetHostAssignments(ctx context.Context, virtualStorage, relativePath string) ([]string, error)
+ GetHostAssignments(ctx context.Context, virtualStorage string, repositoryID int64) ([]string, error)
}
// ErrNoSuitableNode is returned when there is not suitable node to serve a request.
@@ -207,7 +207,7 @@ func (r *PerRepositoryRouter) RouteRepositoryMutator(ctx context.Context, virtua
return RepositoryMutatorRoute{}, ErrRepositoryReadOnly
}
- assignedStorages, err := r.ag.GetHostAssignments(ctx, virtualStorage, relativePath)
+ assignedStorages, err := r.ag.GetHostAssignments(ctx, virtualStorage, repositoryID)
if err != nil {
return RepositoryMutatorRoute{}, fmt.Errorf("get host assignments: %w", err)
}