Skip to content
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

[dbnode] Add ExcludeOrigin to skip localhost on BorrowConnections #3066

Merged
merged 1 commit into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/dbnode/client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,10 @@ func (s *session) BorrowConnections(
// Error or has broken
return
}
if opts.ExcludeOrigin && s.origin != nil && s.origin.ID() == host.ID() {
// Skip origin host.
return
}

var (
userResult WithBorrowConnectionResult
Expand Down Expand Up @@ -937,7 +941,7 @@ func (s *session) setTopologyWithLock(topoMap topology.Map, queues []hostQueue,

if s.pools.multiReaderIteratorArray == nil {
s.pools.multiReaderIteratorArray = encoding.NewMultiReaderIteratorArrayPool([]pool.Bucket{
pool.Bucket{
{
Capacity: replicas,
Count: s.opts.SeriesIteratorPoolSize(),
},
Expand Down
3 changes: 3 additions & 0 deletions src/dbnode/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ type BorrowConnectionOptions struct {
// ContinueOnBorrowError allows skipping hosts that cannot borrow
// a connection for.
ContinueOnBorrowError bool
// ExcludeOrigin will exclude attempting to borrow a connection for
// the origin host (i.e. the local host).
ExcludeOrigin bool
}

// BorrowConnectionsResult is a result used when borrowing connections.
Expand Down