This repository was archived by the owner on Sep 30, 2024. It is now read-only.
search: support draining Zoekt instances#62005
Merged
Merged
Conversation
This change lets us set the ENV on frontend with the Zoekt endpoints we want to drain. As a consequence all repos indexed by those instances will be assigned to other instances. Search still targets all instances. After an instance has been fully drained, we can remove it without user impact. Here is how the process would look like: 1. Set ENV on frontend as restart: INDEXED_SEARCH_DRAIN_SERVERS=<endpoint> 2. Monitor Zoekt dashboard to see when indexes have been migrated. Depending on the number of repos, this can take hours or even days. 3. Remove empty instance 4. Unset ENV Test plan: - New unit test - manual testing
I got carried away
stefanhengl
approved these changes
Apr 18, 2024
Member
jtibshirani
reviewed
Apr 18, 2024
jtibshirani
left a comment
Contributor
There was a problem hiding this comment.
Nice, this turned out quite clean.
sourcegraph-release-bot
pushed a commit
that referenced
this pull request
Apr 19, 2024
This PR implements support for draining a zoekt replica via including its hostname in the comma-separated environment variable INDEXED_SEARCH_DRAIN_SERVERS on sourcegraph-frontend. The way this functionality is implemented is via adjusting the endpoint map we use when making assignment of repos. We still report the hostname as part of the list of endpoints. However, the endpoint is left out of the consistent hash which maps the repositories to endpoints. Our interactions with zoekt are already designed to do smooth rebalancing when the set of endpoints changes. We have logic to only remove repos from a replica once its new endpoint has it, and we support deduplication of search results across endpoints. Co-authored-by: Stefan Hengl <stefan@sourcegraph.com> (cherry picked from commit 3313683)
keegancsmith
added a commit
that referenced
this pull request
Apr 19, 2024
search: support draining Zoekt instances (#62005) This PR implements support for draining a zoekt replica via including its hostname in the comma-separated environment variable INDEXED_SEARCH_DRAIN_SERVERS on sourcegraph-frontend. The way this functionality is implemented is via adjusting the endpoint map we use when making assignment of repos. We still report the hostname as part of the list of endpoints. However, the endpoint is left out of the consistent hash which maps the repositories to endpoints. Our interactions with zoekt are already designed to do smooth rebalancing when the set of endpoints changes. We have logic to only remove repos from a replica once its new endpoint has it, and we support deduplication of search results across endpoints. Co-authored-by: Stefan Hengl <stefan@sourcegraph.com> (cherry picked from commit 3313683) Co-authored-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an alternative implementation to https://github.com/sourcegraph/sourcegraph/pull/61833
This PR implements support for draining a zoekt replica via including its hostname in the comma-separated environment variable
INDEXED_SEARCH_DRAIN_SERVERSon sourcegraph-frontend.The way this functionality is implemented is via adjusting the endpoint map we use when making assignment of repos. We still report the hostname as part of the list of endpoints. However, the endpoint is left out of the consistent hash which maps the repositories to endpoints.
Our interactions with zoekt are already designed to do smooth rebalancing when the set of endpoints changes. We have logic to only remove repos from a replica once its new endpoint has it, and we support deduplication of search results across endpoints.
Test Plan: Stefan manually tested it.
Co-authored-by: @stefanhengl