From ac8b1931f2c695d18d7034686327e82932ed5523 Mon Sep 17 00:00:00 2001 From: Austen Lacy Date: Thu, 12 Oct 2023 19:05:48 +0000 Subject: [PATCH] improve error messages in tablet gateway when primary tablets are not serving Signed-off-by: Austen Lacy --- go/vt/vtgate/tabletgateway.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/go/vt/vtgate/tabletgateway.go b/go/vt/vtgate/tabletgateway.go index 6b4efde2768..1650c28a4fd 100644 --- a/go/vt/vtgate/tabletgateway.go +++ b/go/vt/vtgate/tabletgateway.go @@ -297,12 +297,12 @@ func (gw *TabletGateway) withRetry(ctx context.Context, target *querypb.Target, // if we have a keyspace event watcher, check if the reason why our primary is not available is that it's currently being resharded // or if a reparent operation is in progress. if kev := gw.kev; kev != nil { - if kev.TargetIsBeingResharded(target) { - err = vterrors.Errorf(vtrpcpb.Code_CLUSTER_EVENT, "current keyspace is being resharded") + if kev.PrimaryIsNotServing(target) { + err = vterrors.Errorf(vtrpcpb.Code_CLUSTER_EVENT, "primary is not serving, there could be a reparent operation in progress") continue } - if kev.PrimaryIsNotServing(target) { - err = vterrors.Errorf(vtrpcpb.Code_CLUSTER_EVENT, "primary is not serving, there is a reparent operation in progress") + if kev.TargetIsBeingResharded(target) { + err = vterrors.Errorf(vtrpcpb.Code_CLUSTER_EVENT, "current keyspace is potentially being resharded") continue } }