From 14ce2792d2e451e8d79ee7863aa97823722a5eac Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Wed, 15 Jan 2025 20:48:36 +0100 Subject: [PATCH] sort result Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/tablet_discovery.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/go/vt/vtorc/logic/tablet_discovery.go b/go/vt/vtorc/logic/tablet_discovery.go index 0a92006a2e8..761dafdd0e3 100644 --- a/go/vt/vtorc/logic/tablet_discovery.go +++ b/go/vt/vtorc/logic/tablet_discovery.go @@ -157,6 +157,12 @@ func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) { return nil, err } + slices.SortStableFunc(keyspaceShards, func(a, b *topo.KeyspaceShard) int { + ksStrA := topoproto.KeyspaceShardString(a.Keyspace, a.Shard) + ksStrB := topoproto.KeyspaceShardString(b.Keyspace, b.Shard) + return strings.Compare(ksStrA, ksStrB) + }) + return keyspaceShards, nil }