Skip to content

Commit

Permalink
Merge #81857
Browse files Browse the repository at this point in the history
81857: sql/catalog/lease: add some event logging around lease acquisition r=ajwerner a=ajwerner

Before this, there was a black hole of time when we were acquiring a lease.
The singleflight prevents tracing of the actual acquisition.

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
craig[bot] and ajwerner committed May 25, 2022
2 parents c86696e + c1b3f2e commit f9afd5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/sql/catalog/lease/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ func (m *Manager) AcquireFreshestFromStore(ctx context.Context, id descpb.ID) er
// The boolean returned is true if this call was actually responsible for the
// lease acquisition.
func acquireNodeLease(ctx context.Context, m *Manager, id descpb.ID) (bool, error) {
start := timeutil.Now()
log.VEventf(ctx, 2, "acquiring lease for descriptor %d", id)
var toRelease *storedLease
resultChan, didAcquire := m.storage.group.DoChan(fmt.Sprintf("acquire%d", id), func() (interface{}, error) {
// Note that we use a new `context` here to avoid a situation where a cancellation
Expand Down Expand Up @@ -516,6 +518,7 @@ func acquireNodeLease(ctx context.Context, m *Manager, id descpb.ID) (bool, erro
return false, result.Err
}
}
log.VEventf(ctx, 2, "acquired lease for descriptor %d, took %v", id, timeutil.Since(start))
return didAcquire, nil
}

Expand Down

0 comments on commit f9afd5a

Please sign in to comment.