Add validation that a zoekt repo cannot be assigned to same replica
requested to merge 467405-validate-zoekt_repository-cannot-assign-to-same-replica-unless-reallocating into master
What does this MR do and why?
Add a new state reallocating
in the Search::Zoekt::Index
. Add a new validation in the Search::Zoekt::Replica
that a project can not be assigned to the same replica via indices unless the index is in a reallocating
state.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Query plan
https://console.postgres.ai/shared/1a0d7fc9-ccf1-4407-bfcf-7f2bcf9c7a56
SELECT
1 AS one
FROM
"zoekt_indices"
INNER JOIN "zoekt_repositories" ON "zoekt_repositories"."zoekt_index_id" = "zoekt_indices"."id"
WHERE
"zoekt_indices"."zoekt_replica_id" = 4
AND "zoekt_indices"."state" IS NOT NULL
AND "zoekt_repositories"."project_id" IS NOT NULL
GROUP BY
"zoekt_repositories"."project_id"
HAVING (count(zoekt_indices.id) > 1)
LIMIT 1
Related to #467405 (closed)
Edited by Ravi Kumar