Skip to content

Commit

Permalink
add more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjinx committed Oct 18, 2023
1 parent 0a34bf7 commit 184bd78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/vt/topo/consultopo/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (s *Server) Lock(ctx context.Context, dirPath, contents string) (topo.LockD

lockPath := path.Join(s.root, dirPath, locksFilename)

log.Infof("slack: trying to lock consul topo: dirPath: %s, lockPath: %s", dirPath, lockPath)

lockOpts := &api.LockOptions{
Key: lockPath,
Value: []byte(contents),
Expand All @@ -72,6 +74,7 @@ func (s *Server) Lock(ctx context.Context, dirPath, contents string) (topo.LockD
return nil, err
}

log.Infof("slack: trying to wait here until we are the only one or timeout(%vs) or ttl(%vs)", lockOpts.SessionOpts.LockDelay, lockOpts.SessionOpts.TTL)
// Wait until we are the only ones in this client trying to
// lock that path.
s.mu.Lock()
Expand Down Expand Up @@ -108,6 +111,7 @@ func (s *Server) Lock(ctx context.Context, dirPath, contents string) (topo.LockD
// Consul will return empty leaderCh with nil error if we cannot get lock before the timeout
// therefore we return a timeout error here
if lost == nil {
log.Info("slack: sorry, tried to lock but it timed out..")
return nil, topo.NewError(topo.Timeout, lockPath)
}
return nil, err
Expand Down
1 change: 1 addition & 0 deletions go/vt/vttablet/tabletmanager/rpc_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ func (tm *TabletManager) setReplicationSourceRepairReplication(ctx context.Conte
}

if err = topo.CheckShardLocked(ctx, parent.Tablet.GetKeyspace(), parent.Tablet.GetShard()); err != nil {
log.Errorf("slack: CheckShardLocked failed with err: %v", err)
var unlock func(*error)
ctx, unlock, err = tm.TopoServer.LockShard(ctx, parent.Tablet.GetKeyspace(), parent.Tablet.GetShard(), fmt.Sprintf("repairReplication to %v as parent)", topoproto.TabletAliasString(parentAlias)))

Expand Down

0 comments on commit 184bd78

Please sign in to comment.