diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-10-11 15:30:35 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-10-14 11:14:32 +0300 |
commit | afc20d772239481c6b55dcd0f9916a602cd50ac1 (patch) | |
tree | 767644259acd3a17fddf3ae096ddcedd322ec3ea /internal | |
parent | 1b032cf18e9599655f672d5a79f5124976cd8d2a (diff) |
Get consistent storages by repository id in PerRepositoryRouter
This commit updates the PerRepositoryRouter's mutator routing to get
consistent storages by the repository ID to ensure the query refers
to the same repository as the other queries in the method. This avoids
races in cases such as the repository being renamed in between the queries.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/praefect/router_per_repository.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/praefect/router_per_repository.go b/internal/praefect/router_per_repository.go index 2317029d1..31e8dd059 100644 --- a/internal/praefect/router_per_repository.go +++ b/internal/praefect/router_per_repository.go @@ -198,7 +198,7 @@ func (r *PerRepositoryRouter) RouteRepositoryMutator(ctx context.Context, virtua return RepositoryMutatorRoute{}, nodes.ErrPrimaryNotHealthy } - consistentStorages, err := r.csg.GetConsistentStorages(ctx, virtualStorage, relativePath) + consistentStorages, err := r.rs.GetConsistentStoragesByRepositoryID(ctx, repositoryID) if err != nil { return RepositoryMutatorRoute{}, fmt.Errorf("consistent storages: %w", err) } |