Skip to content

Comments

Always include one non-local target during discovery#583

Closed
henryr wants to merge 1 commit intovtgateproxy-15from
hnr-v15-non-local-target
Closed

Always include one non-local target during discovery#583
henryr wants to merge 1 commit intovtgateproxy-15from
hnr-v15-non-local-target

Conversation

@henryr
Copy link

@henryr henryr commented Jan 16, 2025

In case an entire AZ, or other affinity group, fails at once it's useful to have one backup target in another AZ. So let's grab one every time we set the targets for a given pool. The target should be shuffle-sorted to the end of the target list, so in the normal state it should never get used.

Signed-off-by: Henry Robinson <hrobinson@slack-corp.com>
@henryr henryr requested a review from a team as a code owner January 16, 2025 12:05
targets[poolType] = targets[poolType][:b.numConnections]
// Always grab one non-local target to protect against a complete local failure.
nonLocal := targets[poolType][len(targets[poolType])-1]
targets[poolType] = append(targets[poolType][:b.numConnections], nonLocal)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantically you should probably only slice to [:b.numConnections-1] so that the total conns are still the number that we set, it's just only N-1 of them are AZ-affine?

@@ -323,7 +323,9 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
for poolType := range targets {
b.sorter.shuffleSort(targets[poolType], b.affinityField, b.affinityValue)
if len(targets[poolType]) > *numConnections {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: preexisting code and no change in behavior, but this should be if len(targets[poolType]) > b.numConnections {

@github-actions
Copy link

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale label Feb 16, 2025
@github-actions
Copy link

This PR was closed because it has been stale for 7 days with no activity.

@github-actions github-actions bot closed this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants