Skip to content

Commit

Permalink
Replication logs
Browse files Browse the repository at this point in the history
  • Loading branch information
aadi-shopify committed Oct 10, 2024
1 parent 6b24a14 commit cf566e1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions go/vt/discovery/tablet_picker.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ func (tp *TabletPicker) GetMatchingTablets(ctx context.Context) []*topo.TabletIn
// Match cell, keyspace, and shard.
sri, err := tp.ts.GetShardReplication(shortCtx, cell, tp.keyspace, tp.shard)
if err != nil {
log.Warningf("ShardReplication -- GetMatchingTablets failed for cell %s, keyspace %s, shard %s: %v", cell, tp.keyspace, tp.shard, err)
continue
}
for _, node := range sri.Nodes {
Expand Down
3 changes: 3 additions & 0 deletions go/vt/topo/helpers/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"context"

"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/vterrors"
Expand Down Expand Up @@ -164,10 +165,12 @@ func CompareShardReplications(ctx context.Context, fromTS, toTS *topo.Server) er
for _, cell := range cells {
fromSRi, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
log.Warningf("GetShardReplication-- FromTS.CompareShardReplications failed for cell %s, keyspace %s, shard %s: %v", cell, keyspace, shard, err)
return vterrors.Wrapf(err, "GetShardReplication(%v, %v, %v)", cell, keyspace, shard)
}
toSRi, err := toTS.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
log.Warningf("GetShardReplication-- toTS.CompareShardReplications failed for cell %s, keyspace %s, shard %s: %v", cell, keyspace, shard, err)
return vterrors.Wrapf(err, "GetShardReplication(%v, %v, %v)", cell, keyspace, shard)
}
if !reflect.DeepEqual(fromSRi.ShardReplication, toSRi.ShardReplication) {
Expand Down
1 change: 1 addition & 0 deletions go/vt/topo/helpers/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) error
for _, cell := range cells {
sri, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
log.Warningf("GetShardReplication-- CopyShardReplications failed for cell %s, keyspace %s, shard %s: %v", cell, keyspace, shard, err)
return fmt.Errorf("GetShardReplication(%v, %v, %v): %w", cell, keyspace, shard, err)
}

Expand Down
3 changes: 3 additions & 0 deletions go/vt/topo/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspac
go func(cell string) {
defer wg.Done()
sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
log.Warningf("GetShardReplication-- FindAllTabletAliasesInShardByCell failed for cell %s, keyspace %s, shard %s: %v", cell, keyspace, shard, err)
}
switch {
case err == nil:
mutex.Lock()
Expand Down
1 change: 1 addition & 0 deletions go/vt/topo/tablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ func Validate(ctx context.Context, ts *Server, tabletAlias *topodatapb.TabletAli
// Validate the entry in the shard replication nodes
si, err := ts.GetShardReplication(ctx, tablet.Alias.Cell, tablet.Keyspace, tablet.Shard)
if err != nil {
log.Warningf("GetShardReplication-- Validate failed for cell %s, keyspace %s, shard %s: %v", tablet.Alias.Cell, tablet.Keyspace, tablet.Shard, err)
return err
}

Expand Down

0 comments on commit cf566e1

Please sign in to comment.