-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always include one non-local target during discovery #583
base: vtgateproxy-15
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,7 +323,9 @@ | |
for poolType := range targets { | ||
b.sorter.shuffleSort(targets[poolType], b.affinityField, b.affinityValue) | ||
if len(targets[poolType]) > *numConnections { | ||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pedantically you should probably only slice to |
||
} | ||
targetCount.Set(poolType, int64(len(targets[poolType]))) | ||
} | ||
|
@@ -414,7 +416,7 @@ | |
if r.currentAddrs != nil && warmupTime.Seconds() > 0 { | ||
combined := append(r.currentAddrs, addrs...) | ||
log.V(100).Infof("updating targets for %s to warmup %v", r.target.URL.String(), targets) | ||
r.clientConn.UpdateState(resolver.State{Addresses: combined}) | ||
Check failure on line 419 in go/vt/vtgateproxy/discovery.go GitHub Actions / Static Code Checks Etc
|
||
time.Sleep(*warmupTime) | ||
} | ||
|
||
|
There was a problem hiding this comment.
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 {