From b155790883830d24f983f61e844397e53fb3434c Mon Sep 17 00:00:00 2001 From: hzhou Date: Wed, 3 Feb 2021 19:25:29 -0800 Subject: [PATCH] more resilient rebuild keyspace graph check, tablet controls not in effect if there has no actual disabled query service Signed-off-by: hzhou --- go/vt/topotools/rebuild_keyspace.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/go/vt/topotools/rebuild_keyspace.go b/go/vt/topotools/rebuild_keyspace.go index 1da0468321d..bc72b2dd8b1 100644 --- a/go/vt/topotools/rebuild_keyspace.go +++ b/go/vt/topotools/rebuild_keyspace.go @@ -83,10 +83,11 @@ func RebuildKeyspaceLocked(ctx context.Context, log logutil.Logger, ts *topo.Ser switch { case err == nil: for _, partition := range srvKeyspace.GetPartitions() { - if partition.GetShardTabletControls() != nil { - return fmt.Errorf("can't rebuild serving keyspace while a migration is on going. TabletControls is set for partition %v", partition) + for _, shardTabletControl := range partition.GetShardTabletControls() { + if shardTabletControl.QueryServiceDisabled { + return fmt.Errorf("can't rebuild serving keyspace while a migration is on going. TabletControls is set for partition %v", partition) + } } - } case topo.IsErrType(err, topo.NoNode): // NOOP