From bbfbaa1494995fb532f968eb9411a5c680953cf0 Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 3 Dec 2024 10:28:35 +0000 Subject: [PATCH] kvserver/rangefeed: Clear rather than Close memory budget 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 --- pkg/kv/kvserver/rangefeed/budget.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kv/kvserver/rangefeed/budget.go b/pkg/kv/kvserver/rangefeed/budget.go index 7966843c0937..ce43c2e40b1f 100644 --- a/pkg/kv/kvserver/rangefeed/budget.go +++ b/pkg/kv/kvserver/rangefeed/budget.go @@ -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() })