Skip to content

Update mutator routing queries to use repository ID

Sami Hiltunen requested to merge smh-cluster-id-router into master

PerRepositoryRouter's mutator routing method runs multiple different database queries. The queries are currently keyed by (virtual_storage, relative_path). The repository this key points to can change during the routing if for example the repository is recreated or renamed during the routing. To avoid this, this MR resolves the external (virtual_storage, relative_path) key to a static repository ID once in the beginning of the routing function. This ensures all of the later queries refer to the same repository as the repository ID never changes.

The access routing can mostly remain as it is, since it only runs one query either to get the primary or to get the consistent storages.

Given the number of queries the router is performing, it might make sense in a later MR to combine the individual queries into a single purpose built query for the router.

Edited by Sami Hiltunen

Merge request reports