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-14 11:14:32 +0300
commit311fbb9789c5310314c8a2c6916bfb331aa4661b (patch)
treed09cf1dae2d774767da16e4b0a7cd405340da682 /internal/praefect/router_per_repository.go
parentb47cb9f7818c124b88b0230ec0c7dc5183ca25df (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 4cb4da498..2317029d1 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, 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, repositoryID)
if err != nil {
return RepositoryMutatorRoute{}, fmt.Errorf("get host assignments: %w", err)
}