Browse Source

clientv3: do not treat Internal codes as halting

Fixes #6277
Anthony Romano 9 years ago
parent
commit
5e963608b7
1 changed files with 8 additions and 1 deletions
  1. 8 1
      clientv3/client.go

+ 8 - 1
clientv3/client.go

@@ -295,7 +295,14 @@ func isHaltErr(ctx context.Context, err error) bool {
 	if err == nil {
 	if err == nil {
 		return false
 		return false
 	}
 	}
-	return grpc.Code(err) != codes.Unavailable
+	code := grpc.Code(err)
+	// Unavailable codes mean the system will be right back.
+	// (e.g., can't connect, lost leader)
+	// Treat Internal codes as if something failed, leaving the
+	// system in an inconsistent state, but retrying could make progress.
+	// (e.g., failed in middle of send, corrupted frame)
+	// TODO: are permanent Internal errors possible from grpc?
+	return code != codes.Unavailable && code != codes.Internal
 }
 }
 
 
 func toErr(ctx context.Context, err error) error {
 func toErr(ctx context.Context, err error) error {