Skip to content

Commit

Permalink
[dbnode] Add ExcludeOrigin to skip localhost on BorrowConnections (#3066
Browse files Browse the repository at this point in the history
)
  • Loading branch information
robskillington authored Jan 5, 2021
1 parent 11b2cdf commit 14e4c08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 14e4c08

Please sign in to comment.