Skip to content

Commit

Permalink
kv: recycle SpanSets returned during optimistic eval validation
Browse files Browse the repository at this point in the history
This commit adds `Release` calls for both SpanSets returned by
`collectSpansRead` on the optimistic eval validation path. The failure
to recycle these SpanSets was causing a leak from the `SpanSet` memory
pool of both top level objects and the recycled inner slices.

We have the same issue at the other caller of `collectSpansRead`, which
is being tracked more broadly in #91374.

Release note: None
Epic: None
  • Loading branch information
nvanbenschoten committed Nov 6, 2022
1 parent 4bdfe6e commit 3455572
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kv/kvserver/replica_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ func (r *Replica) executeReadOnlyBatch(
if err != nil {
return nil, g, nil, roachpb.NewError(err)
}
defer latchSpansRead.Release()
defer lockSpansRead.Release()
if ok := g.CheckOptimisticNoConflicts(latchSpansRead, lockSpansRead); !ok {
return nil, g, nil, roachpb.NewError(roachpb.NewOptimisticEvalConflictsError())
}
Expand Down

0 comments on commit 3455572

Please sign in to comment.