Documentation ¶
Index ¶
- Variables
- func InitMetrics(registry *prometheus.Registry)
- type MemConsumeRecord
- type MemQuota
- func (m *MemQuota) AddTable(span tablepb.Span)
- func (m *MemQuota) BlockAcquire(nBytes uint64) error
- func (m *MemQuota) ClearTable(span tablepb.Span) uint64
- func (m *MemQuota) Close()
- func (m *MemQuota) ForceAcquire(nBytes uint64)
- func (m *MemQuota) GetUsedBytes() uint64
- func (m *MemQuota) Record(span tablepb.Span, resolved model.ResolvedTs, nBytes uint64)
- func (m *MemQuota) Refund(nBytes uint64)
- func (m *MemQuota) Release(span tablepb.Span, resolved model.ResolvedTs)
- func (m *MemQuota) RemoveTable(span tablepb.Span) uint64
- func (m *MemQuota) TryAcquire(nBytes uint64) bool
Constants ¶
This section is empty.
Variables ¶
var MemoryQuota = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "ticdc", Subsystem: "sinkmanager", Name: "memory_quota", Help: "memory quota of the changefeed", }, []string{"namespace", "changefeed", "type", "component"})
MemoryQuota indicates memory usage of a changefeed.
Functions ¶
func InitMetrics ¶
func InitMetrics(registry *prometheus.Registry)
InitMetrics registers all metrics in this file.
Types ¶
type MemConsumeRecord ¶
type MemConsumeRecord struct { ResolvedTs model.ResolvedTs Size uint64 }
MemConsumeRecord is used to trace memory usage.
type MemQuota ¶
type MemQuota struct {
// contains filtered or unexported fields
}
MemQuota is used to trace memory usage.
func NewMemQuota ¶
func NewMemQuota(changefeedID model.ChangeFeedID, totalBytes uint64, comp string) *MemQuota
NewMemQuota creates a MemQuota instance.
func (*MemQuota) BlockAcquire ¶
BlockAcquire is used to block the request when the memory quota is not available.
func (*MemQuota) ClearTable ¶
ClearTable is like RemoveTable but only clear the memory usage records but doesn't remove the table.
func (*MemQuota) Close ¶
func (m *MemQuota) Close()
Close the mem quota and notify the blocked acquire.
func (*MemQuota) ForceAcquire ¶
ForceAcquire is used to force acquire the memory quota.
func (*MemQuota) GetUsedBytes ¶
GetUsedBytes returns the used memory quota.
func (*MemQuota) Release ¶
func (m *MemQuota) Release(span tablepb.Span, resolved model.ResolvedTs)
Release try to use resolvedTs to release the memory quota. Because we append records in order, we can use binary search to find the first record that is greater than resolvedTs, and release the memory quota of the records before it.
func (*MemQuota) RemoveTable ¶
RemoveTable clears all records of the table and remove the table. Return the cleaned memory quota.
func (*MemQuota) TryAcquire ¶
TryAcquire returns true if the memory quota is available, otherwise returns false.