From 9f6620dfccfaf65a51f6c0fbda7391cfea8017b0 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 03:25:37 +0100 Subject: [PATCH 01/10] `vtorc`: store cells in backend and periodically refresh Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/db/generate_base.go | 11 +++- go/vt/vtorc/inst/cell_dao.go | 45 ++++++++++++++ go/vt/vtorc/inst/cell_dao_test.go | 39 ++++++++++++ go/vt/vtorc/logic/cell_discovery.go | 76 ++++++++++++++++++++++++ go/vt/vtorc/logic/cell_discovery_test.go | 52 ++++++++++++++++ go/vt/vtorc/logic/tablet_discovery.go | 9 +-- go/vt/vtorc/logic/vtorc.go | 5 ++ 7 files changed, 232 insertions(+), 5 deletions(-) create mode 100644 go/vt/vtorc/inst/cell_dao.go create mode 100644 go/vt/vtorc/inst/cell_dao_test.go create mode 100644 go/vt/vtorc/logic/cell_discovery.go create mode 100644 go/vt/vtorc/logic/cell_discovery_test.go diff --git a/go/vt/vtorc/db/generate_base.go b/go/vt/vtorc/db/generate_base.go index 8baa9a12476..0527007dc22 100644 --- a/go/vt/vtorc/db/generate_base.go +++ b/go/vt/vtorc/db/generate_base.go @@ -29,9 +29,10 @@ var TableNames = []string{ "global_recovery_disable", "topology_recovery_steps", "database_instance_stale_binlog_coordinates", - "vitess_tablet", + "vitess_cell", "vitess_keyspace", "vitess_shard", + "vitess_tablet", } // vtorcBackend is a list of SQL statements required to build the vtorc backend @@ -307,6 +308,14 @@ CREATE TABLE vitess_shard ( PRIMARY KEY (keyspace, shard) )`, ` +DROP TABLE IF EXISTS vitess_cell +`, + ` +CREATE TABLE vitess_cell ( + cell varchar(128) NOT NULL, + PRIMARY KEY (cell) +)`, + ` CREATE INDEX source_host_port_idx_database_instance_database_instance on database_instance (source_host, source_port) `, ` diff --git a/go/vt/vtorc/inst/cell_dao.go b/go/vt/vtorc/inst/cell_dao.go new file mode 100644 index 00000000000..35d0ab85716 --- /dev/null +++ b/go/vt/vtorc/inst/cell_dao.go @@ -0,0 +1,45 @@ +/* +Copyright 2025 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package inst + +import ( + "vitess.io/vitess/go/vt/external/golib/sqlutils" + "vitess.io/vitess/go/vt/vtorc/db" +) + +// ReadCells reads all the vitess cell names. +func ReadCells() ([]string, error) { + cells := make([]string, 0) + query := `SELECT cell FROM vitess_cell` + err := db.QueryVTOrc(query, nil, func(row sqlutils.RowMap) error { + cells = append(cells, row.GetString("cell")) + return nil + }) + return cells, err +} + +// SaveCell saves the keyspace record against the keyspace name. +func SaveCell(cell string) error { + _, err := db.ExecVTOrc(`REPLACE INTO vitess_cell (cell) VALUES(?)`, cell) + return err +} + +// DeleteCell deletes a cell. +func DeleteCell(cell string) (err error) { + _, err = db.ExecVTOrc(`DELETE FROM vitess_cell WHERE cell = ?`, cell) + return err +} diff --git a/go/vt/vtorc/inst/cell_dao_test.go b/go/vt/vtorc/inst/cell_dao_test.go new file mode 100644 index 00000000000..792995a6763 --- /dev/null +++ b/go/vt/vtorc/inst/cell_dao_test.go @@ -0,0 +1,39 @@ +/* +Copyright 2025 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package inst + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "vitess.io/vitess/go/vt/vtorc/db" +) + +func TestSaveAndReadCells(t *testing.T) { + // Clear the database after the test. The easiest way to do that is to run all the initialization commands again. + defer func() { + db.ClearVTOrcDatabase() + }() + cells := []string{"zone1", "zone2", "zone3"} + for _, cell := range cells { + require.NoError(t, SaveCell(cell)) + } + cellsRead, err := ReadCells() + require.NoError(t, err) + require.Equal(t, cells, cellsRead) +} diff --git a/go/vt/vtorc/logic/cell_discovery.go b/go/vt/vtorc/logic/cell_discovery.go new file mode 100644 index 00000000000..647ccc8e557 --- /dev/null +++ b/go/vt/vtorc/logic/cell_discovery.go @@ -0,0 +1,76 @@ +/* +Copyright 2025 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logic + +import ( + "context" + "sync" + + "vitess.io/vitess/go/vt/log" + "vitess.io/vitess/go/vt/topo" + "vitess.io/vitess/go/vt/vtorc/inst" +) + +var refreshCellsMu sync.Mutex + +// RefreshCells refreshes the list of cells. +func RefreshCells(ctx context.Context) error { + cellsCtx, cellsCancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout) + defer cellsCancel() + cells, err := ts.GetKnownCells(cellsCtx) + if err != nil { + return err + } + return refreshCells(cells) +} + +// refreshCells saves a slice of cells and removes +// stale cells that were not updated. +func refreshCells(cells []string) (err error) { + refreshCellsMu.Lock() + defer refreshCellsMu.Unlock() + + // save cells. + updated := make(map[string]bool) + for _, cell := range cells { + err = inst.SaveCell(cell) + if err != nil { + log.Error(err) + return err + } + updated[cell] = true + } + + // read all saved cells. the values should not + // be changing because we are holding a lock. + cells, err = inst.ReadCells() + if err != nil { + return err + } + + // delete cells that are stale. + for _, cell := range cells { + if updated[cell] { + continue + } + log.Infof("Forgetting stale cell %q", cell) + if err = inst.DeleteCell(cell); err != nil { + return err + } + } + return nil +} diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go new file mode 100644 index 00000000000..0ed4fa54b8a --- /dev/null +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -0,0 +1,52 @@ +/* +Copyright 2025 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logic + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + "vitess.io/vitess/go/vt/topo/memorytopo" + "vitess.io/vitess/go/vt/vtorc/db" + "vitess.io/vitess/go/vt/vtorc/inst" +) + +func TestRefreshAllCells(t *testing.T) { + // Store the old flags and restore on test completion + oldTs := ts + defer func() { + ts = oldTs + }() + + db.ClearVTOrcDatabase() + defer func() { + db.ClearVTOrcDatabase() + }() + + cells := []string{"zone1", "zone2", "zone3"} + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + ts = memorytopo.NewServer(ctx, cells...) + + require.NoError(t, RefreshCells(ctx)) + + cellsRead, err := inst.ReadCells() + require.NoError(t, err) + require.Equal(t, cells, cellsRead) +} diff --git a/go/vt/vtorc/logic/tablet_discovery.go b/go/vt/vtorc/logic/tablet_discovery.go index c5c23df0cd0..5ad03470820 100644 --- a/go/vt/vtorc/logic/tablet_discovery.go +++ b/go/vt/vtorc/logic/tablet_discovery.go @@ -181,13 +181,14 @@ func refreshAllTablets(ctx context.Context) error { // refreshTabletsUsing refreshes tablets using a provided loader. func refreshTabletsUsing(ctx context.Context, loader func(tabletAlias string), forceRefresh bool) error { - // Get all cells. - ctx, cancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout) - defer cancel() - cells, err := ts.GetKnownCells(ctx) + cells, err := inst.ReadCells() if err != nil { return err } + if len(cells) == 0 { + log.Error("Found no cells") + return nil + } // Get all tablets from all cells. getTabletsCtx, getTabletsCancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout) diff --git a/go/vt/vtorc/logic/vtorc.go b/go/vt/vtorc/logic/vtorc.go index 5ac5af50d47..d9aec99830e 100644 --- a/go/vt/vtorc/logic/vtorc.go +++ b/go/vt/vtorc/logic/vtorc.go @@ -321,6 +321,11 @@ func refreshAllInformation(ctx context.Context) error { // Create an errgroup eg, ctx := errgroup.WithContext(ctx) + // Refresh all cells. + eg.Go(func() error { + return RefreshCells(ctx) + }) + // Refresh all keyspace information. eg.Go(func() error { return RefreshAllKeyspacesAndShards(ctx) From dcefb1fe1e1ff2c2a063a7a5d65231457915d58e Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 03:52:39 +0100 Subject: [PATCH 02/10] improve logging Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery.go | 5 +++-- go/vt/vtorc/logic/cell_discovery_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/go/vt/vtorc/logic/cell_discovery.go b/go/vt/vtorc/logic/cell_discovery.go index 647ccc8e557..1e21178f3a1 100644 --- a/go/vt/vtorc/logic/cell_discovery.go +++ b/go/vt/vtorc/logic/cell_discovery.go @@ -49,7 +49,7 @@ func refreshCells(cells []string) (err error) { for _, cell := range cells { err = inst.SaveCell(cell) if err != nil { - log.Error(err) + log.Errorf("Failed to save cell %q: %+v", cell, err) return err } updated[cell] = true @@ -59,6 +59,7 @@ func refreshCells(cells []string) (err error) { // be changing because we are holding a lock. cells, err = inst.ReadCells() if err != nil { + log.Errorf("Failed to read cells: %+v", err) return err } @@ -69,7 +70,7 @@ func refreshCells(cells []string) (err error) { } log.Infof("Forgetting stale cell %q", cell) if err = inst.DeleteCell(cell); err != nil { - return err + log.Errorf("Failed to delete cell %q: %+v", cell, err) } } return nil diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go index 0ed4fa54b8a..9dcabaebfe1 100644 --- a/go/vt/vtorc/logic/cell_discovery_test.go +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -27,7 +27,7 @@ import ( "vitess.io/vitess/go/vt/vtorc/inst" ) -func TestRefreshAllCells(t *testing.T) { +func TestRefreshCells(t *testing.T) { // Store the old flags and restore on test completion oldTs := ts defer func() { From ceabc6c93aa01fd7bb1db169179498dd1d116960 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 20:12:06 +0100 Subject: [PATCH 03/10] improve logging and comment Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/go/vt/vtorc/logic/cell_discovery.go b/go/vt/vtorc/logic/cell_discovery.go index 1e21178f3a1..b7a667a1155 100644 --- a/go/vt/vtorc/logic/cell_discovery.go +++ b/go/vt/vtorc/logic/cell_discovery.go @@ -49,17 +49,18 @@ func refreshCells(cells []string) (err error) { for _, cell := range cells { err = inst.SaveCell(cell) if err != nil { - log.Errorf("Failed to save cell %q: %+v", cell, err) + log.Errorf("Failed to save cell %s: %+v", cell, err) return err } updated[cell] = true } - // read all saved cells. the values should not - // be changing because we are holding a lock. + // read all saved cells. the values should not be changing + // because we are holding a lock and updates originate + // from this func only. cells, err = inst.ReadCells() if err != nil { - log.Errorf("Failed to read cells: %+v", err) + log.Errorf("Failed to read all cells: %+v", err) return err } @@ -68,9 +69,9 @@ func refreshCells(cells []string) (err error) { if updated[cell] { continue } - log.Infof("Forgetting stale cell %q", cell) + log.Infof("Forgetting stale cell %s", cell) if err = inst.DeleteCell(cell); err != nil { - log.Errorf("Failed to delete cell %q: %+v", cell, err) + log.Errorf("Failed to delete cell %s: %+v", cell, err) } } return nil From de74bbeeeac4e22e7f800c5cd95766b35b67d1c5 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 22:15:46 +0100 Subject: [PATCH 04/10] test cell delete Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go index 9dcabaebfe1..140ce042acc 100644 --- a/go/vt/vtorc/logic/cell_discovery_test.go +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -45,8 +45,13 @@ func TestRefreshCells(t *testing.T) { ts = memorytopo.NewServer(ctx, cells...) require.NoError(t, RefreshCells(ctx)) - cellsRead, err := inst.ReadCells() require.NoError(t, err) require.Equal(t, cells, cellsRead) + + require.NoError(t, ts.DeleteCellInfo(context.Background(), "zone3", true)) + require.NoError(t, RefreshCells(ctx)) + cellsRead, err = inst.ReadCells() + require.NoError(t, err) + require.Equal(t, cells[:2], cellsRead) } From c97a3c7baf49ca095f01f195af35c4ffdf915558 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 22:18:33 +0100 Subject: [PATCH 05/10] test cleanup Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go index 140ce042acc..44cc3a5981b 100644 --- a/go/vt/vtorc/logic/cell_discovery_test.go +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -53,5 +53,5 @@ func TestRefreshCells(t *testing.T) { require.NoError(t, RefreshCells(ctx)) cellsRead, err = inst.ReadCells() require.NoError(t, err) - require.Equal(t, cells[:2], cellsRead) + require.Equal(t, []string{"zone1", "zone2"}, cellsRead) } From e8fed1ca7d7cdaf8e475efbebc1608e86fc6b97e Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Mon, 10 Feb 2025 22:29:16 +0100 Subject: [PATCH 06/10] more testing Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/inst/cell_dao_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/go/vt/vtorc/inst/cell_dao_test.go b/go/vt/vtorc/inst/cell_dao_test.go index 792995a6763..2a367af95c6 100644 --- a/go/vt/vtorc/inst/cell_dao_test.go +++ b/go/vt/vtorc/inst/cell_dao_test.go @@ -24,7 +24,7 @@ import ( "vitess.io/vitess/go/vt/vtorc/db" ) -func TestSaveAndReadCells(t *testing.T) { +func TestSaveReadAndDeleteCells(t *testing.T) { // Clear the database after the test. The easiest way to do that is to run all the initialization commands again. defer func() { db.ClearVTOrcDatabase() @@ -36,4 +36,9 @@ func TestSaveAndReadCells(t *testing.T) { cellsRead, err := ReadCells() require.NoError(t, err) require.Equal(t, cells, cellsRead) + + require.NoError(t, DeleteCell("zone3")) + cellsRead, err = ReadCells() + require.NoError(t, err) + require.Equal(t, []string{"zone1", "zone2"}, cellsRead) } From 7dd6da1748ca03c57e4865bea8da362d7f8d1425 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Tue, 11 Feb 2025 22:27:27 +0100 Subject: [PATCH 07/10] rename func Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/go/vt/vtorc/logic/cell_discovery.go b/go/vt/vtorc/logic/cell_discovery.go index b7a667a1155..55974b6744c 100644 --- a/go/vt/vtorc/logic/cell_discovery.go +++ b/go/vt/vtorc/logic/cell_discovery.go @@ -25,7 +25,7 @@ import ( "vitess.io/vitess/go/vt/vtorc/inst" ) -var refreshCellsMu sync.Mutex +var saveAllCellsMu sync.Mutex // RefreshCells refreshes the list of cells. func RefreshCells(ctx context.Context) error { @@ -35,20 +35,19 @@ func RefreshCells(ctx context.Context) error { if err != nil { return err } - return refreshCells(cells) + return saveAllCells(cells) } -// refreshCells saves a slice of cells and removes -// stale cells that were not updated. -func refreshCells(cells []string) (err error) { - refreshCellsMu.Lock() - defer refreshCellsMu.Unlock() +// saveAllCells saves a slice representing all cells +// and removes stale cells that were not updated. +func saveAllCells(allCells []string) (err error) { + saveAllCellsMu.Lock() + defer saveAllCellsMu.Unlock() // save cells. - updated := make(map[string]bool) - for _, cell := range cells { - err = inst.SaveCell(cell) - if err != nil { + updated := make(map[string]bool, len(allCells)) + for _, cell := range allCells { + if err = inst.SaveCell(cell); err != nil { log.Errorf("Failed to save cell %s: %+v", cell, err) return err } @@ -58,7 +57,7 @@ func refreshCells(cells []string) (err error) { // read all saved cells. the values should not be changing // because we are holding a lock and updates originate // from this func only. - cells, err = inst.ReadCells() + cells, err := inst.ReadCells() if err != nil { log.Errorf("Failed to read all cells: %+v", err) return err From 89031a347aa30d230130d4baa89618967ab8862e Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Tue, 11 Feb 2025 22:31:31 +0100 Subject: [PATCH 08/10] simplify tests Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/inst/cell_dao_test.go | 7 +++---- go/vt/vtorc/logic/cell_discovery_test.go | 8 ++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/go/vt/vtorc/inst/cell_dao_test.go b/go/vt/vtorc/inst/cell_dao_test.go index 2a367af95c6..d474319c1c5 100644 --- a/go/vt/vtorc/inst/cell_dao_test.go +++ b/go/vt/vtorc/inst/cell_dao_test.go @@ -25,10 +25,9 @@ import ( ) func TestSaveReadAndDeleteCells(t *testing.T) { - // Clear the database after the test. The easiest way to do that is to run all the initialization commands again. - defer func() { - db.ClearVTOrcDatabase() - }() + db.ClearVTOrcDatabase() + defer db.ClearVTOrcDatabase() + cells := []string{"zone1", "zone2", "zone3"} for _, cell := range cells { require.NoError(t, SaveCell(cell)) diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go index 44cc3a5981b..f547e0bd55b 100644 --- a/go/vt/vtorc/logic/cell_discovery_test.go +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -28,15 +28,11 @@ import ( ) func TestRefreshCells(t *testing.T) { - // Store the old flags and restore on test completion - oldTs := ts - defer func() { - ts = oldTs - }() - db.ClearVTOrcDatabase() + oldTs := ts defer func() { db.ClearVTOrcDatabase() + ts = oldTs }() cells := []string{"zone1", "zone2", "zone3"} From 81cf199622483433abe77ea2bd6504468366a13e Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Tue, 11 Feb 2025 22:49:19 +0100 Subject: [PATCH 09/10] reuse ctx Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/cell_discovery_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtorc/logic/cell_discovery_test.go b/go/vt/vtorc/logic/cell_discovery_test.go index f547e0bd55b..f1ff45f8758 100644 --- a/go/vt/vtorc/logic/cell_discovery_test.go +++ b/go/vt/vtorc/logic/cell_discovery_test.go @@ -45,7 +45,7 @@ func TestRefreshCells(t *testing.T) { require.NoError(t, err) require.Equal(t, cells, cellsRead) - require.NoError(t, ts.DeleteCellInfo(context.Background(), "zone3", true)) + require.NoError(t, ts.DeleteCellInfo(ctx, "zone3", true)) require.NoError(t, RefreshCells(ctx)) cellsRead, err = inst.ReadCells() require.NoError(t, err) From 6b779316e6eb02b088c6a770abc7323908a2f521 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Wed, 12 Feb 2025 23:38:14 +0100 Subject: [PATCH 10/10] pass cells from backend in refreshTabletsInKeyspaceShard Signed-off-by: Tim Vaillancourt --- go/vt/vtorc/logic/tablet_discovery.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/go/vt/vtorc/logic/tablet_discovery.go b/go/vt/vtorc/logic/tablet_discovery.go index 5ad03470820..18b7d116755 100644 --- a/go/vt/vtorc/logic/tablet_discovery.go +++ b/go/vt/vtorc/logic/tablet_discovery.go @@ -237,7 +237,12 @@ func refreshTabletInfoOfShard(ctx context.Context, keyspace, shard string) { } func refreshTabletsInKeyspaceShard(ctx context.Context, keyspace, shard string, loader func(tabletAlias string), forceRefresh bool, tabletsToIgnore []string) { - tablets, err := ts.GetTabletsByShard(ctx, keyspace, shard) + cells, err := inst.ReadCells() + if err != nil { + log.Errorf("Error fetching cells: %v", err) + return + } + tablets, err := ts.GetTabletsByShardCell(ctx, keyspace, shard, cells) if err != nil { log.Errorf("Error fetching tablets for keyspace/shard %v/%v: %v", keyspace, shard, err) return