diff --git a/src/dbnode/client/session.go b/src/dbnode/client/session.go index e1de530ebe..6c8bdda825 100644 --- a/src/dbnode/client/session.go +++ b/src/dbnode/client/session.go @@ -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 @@ -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(), }, diff --git a/src/dbnode/client/types.go b/src/dbnode/client/types.go index 0de707fe23..2fc6203641 100644 --- a/src/dbnode/client/types.go +++ b/src/dbnode/client/types.go @@ -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.