Skip to content

Commit

Permalink
Merge pull request apache#1263 from znly/zllak/fix/host-selection
Browse files Browse the repository at this point in the history
query executor: better handling of errors for host selection
  • Loading branch information
alourie authored Mar 1, 2019
2 parents ec47935 + 65ca426 commit f6df828
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ Jacob Greenleaf <jacob@jacobgreenleaf.com>
Alex Lourie <alex@instaclustr.com>; <djay.il@gmail.com>
Marco Cadetg <cadetg@gmail.com>
Karl Matthias <karl@matthias.org>
Thomas Meson <zllak@hycik.org>
10 changes: 9 additions & 1 deletion query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ func (q *queryExecutor) do(ctx context.Context, qry ExecutableQuery) *Iter {
iter = q.attemptQuery(ctx, qry, conn)
iter.host = selectedHost.Info()
// Update host
selectedHost.Mark(iter.err)
switch iter.err {
case context.Canceled, context.DeadlineExceeded, ErrNotFound:
// those errors represents logical errors, they should not count
// toward removing a node from the pool
selectedHost.Mark(nil)
return iter
default:
selectedHost.Mark(iter.err)
}

// Exit if the query was successful
// or no retry policy defined or retry attempts were reached
Expand Down

0 comments on commit f6df828

Please sign in to comment.