Skip to content

Commit

Permalink
kvserver/rangefeed: Clear rather than Close memory budget
Browse files Browse the repository at this point in the history
Clear is similar to Close but also resets the "used" and "reserved"
variables. This shouldn't really matter, but recent changes mean that
sometimes a budget for a processor might be "closed" before a give
registration using that processor's goroutine has finished
draining. This is OK since the feed budget is protected by a mutex and
allocations releases after close are allowed. However, it did break a
test under stress.

Epic: none
Release note: None
  • Loading branch information
stevendanna committed Dec 3, 2024
1 parent 8908b0c commit bbfbaa1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/rangefeed/budget.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (f *FeedBudget) Close(ctx context.Context) {
f.closed.Do(func() {
f.mu.Lock()
f.mu.closed = true
f.mu.memBudget.Close(ctx)
f.mu.memBudget.Clear(ctx)
close(f.stopC)
f.mu.Unlock()
})
Expand Down

0 comments on commit bbfbaa1

Please sign in to comment.