Bläddra i källkod

Merge pull request #1263 from znly/zllak/fix/host-selection

query executor: better handling of errors for host selection
Alex Lourie 6 år sedan
förälder
incheckning
f6df8288f9
2 ändrade filer med 10 tillägg och 1 borttagningar
  1. 1 0
      AUTHORS
  2. 9 1
      query_executor.go

+ 1 - 0
AUTHORS

@@ -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>

+ 9 - 1
query_executor.go

@@ -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