Skip to content

Commit

Permalink
Use lower context for updating keyspace
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Mar 14, 2023
1 parent da4ee79 commit 2c11e74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/vt/vttablet/tabletmanager/tm_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,13 @@ func (tm *TabletManager) createKeyspaceShard(ctx context.Context) (*topo.ShardIn
// update the keyspace record to the default.
if ks.SidecarDbName == "" {
ks.SidecarDbName = sidecardb.DefaultName
ctx, unlock, lockErr := tm.TopoServer.LockKeyspace(ctx, tablet.Keyspace, "Setting sidecar database name")
getlockctx, cancel := context.WithTimeout(context.Background(), topo.RemoteOperationTimeout)
defer cancel()
lockctx, unlock, lockErr := tm.TopoServer.LockKeyspace(getlockctx, tablet.Keyspace, "Setting sidecar database name")
if lockErr != nil {
return vterrors.Wrap(lockErr, "createKeyspaceShard: cannot GetOrCreateShard shard")
}
err = tm.TopoServer.UpdateKeyspace(ctx, ks)
err = tm.TopoServer.UpdateKeyspace(lockctx, ks)
unlock(&lockErr)
if err != nil {
return vterrors.Wrap(err, "createKeyspaceShard: cannot GetOrCreateShard shard")
Expand Down

0 comments on commit 2c11e74

Please sign in to comment.