-
Pavlo Strokov authored
gitaly node is a primary. For mutator operations it used to define from what node the response will be returned back to the client. For the read operations it is used to redirect request to or as a fallback option for reads distribution in case it is enabled. The default strategy for defining the primary is an 'sql' which means the primary is tracked inside Postgres database and praefect issues select statement into it each time it needs to define current primary. It creates a high load on the database when there are too many read operations (the outcome of the performance testing). To resolve this problem we change logic of retrieving set of up to date storages to return all storages including primary. So now we don't need to know the current primary and use any storage that has latest generation of the repository to serve the requests. As this information is cached by the in-memory cache praefect won't create a high load on the database anymore. This change also makes check IsLatestGeneration for the primary node redundant as it won't be present in the set of consistent storages if its generation not the latest one. Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/3337
09c6d25d