diff --git a/pkg/statistics/handle/autoanalyze/internal/heap/heap.go b/pkg/statistics/handle/autoanalyze/internal/heap/heap.go index 2870c125f43f3..e5a700e6c9194 100644 --- a/pkg/statistics/handle/autoanalyze/internal/heap/heap.go +++ b/pkg/statistics/handle/autoanalyze/internal/heap/heap.go @@ -16,6 +16,7 @@ // 1. Use the `errors` package from PingCAP. // 2. Use generics to define the `heapData` struct. // 3. Add a peak API. +// 4. Add an IsEmpty API. package heap @@ -221,6 +222,7 @@ func (h *Heap[K, V]) Peek() (V, error) { return h.data.items[h.data.queue[0]].obj, nil } +// IsEmpty returns true if the heap is empty. func (h *Heap[K, V]) IsEmpty() bool { h.lock.RLock() defer h.lock.RUnlock()