Documentation ¶
Overview ¶
A few allocators for TAE
Index ¶
- Constants
- Variables
- func ApiBatchToString(apiBat *api.Batch, printN int) string
- func BitmapEqual(v1, v2 *nulls.Bitmap) bool
- func BlockIDArraryString(ids []ID) string
- func ContextField(format string, a ...any) zap.Field
- func CountField(val int) zap.Field
- func DebugMoBatch(moBat *batch.Batch) string
- func DoIfDebugEnabled(fn func())
- func DoIfErrorEnabled(fn func())
- func DoIfFatalEnabled(fn func())
- func DoIfInfoEnabled(fn func())
- func DoIfWarnEnabled(fn func())
- func DurationField(val time.Duration) zap.Field
- func EncodeCloseInterval(i *ClosedInterval) []byte
- func EncodeID(id *ID) []byte
- func EntityField(val any) zap.Field
- func ErrorField(val error) zap.Field
- func ExceptionField(val any) zap.Field
- func FormatFiled(key string, format string, a ...any) zap.Field
- func GetGlobalSeqNum() uint64
- func HumanReadableBytes(bytes int) string
- func IDArraryString(ids []ID) string
- func IDField(val int) zap.Field
- func InitTAEMPool()
- func LoopGenericSortedDList[T any](head *GenericDLNode[T], fn func(node *GenericDLNode[T]) bool, reverse bool)
- func MOOrRoaringBitmap(bm *nulls.Bitmap, rbm *roaring.Bitmap)
- func MoBatchToString(moBat *batch.Batch, printN int) string
- func MoVectorToString(v *vector.Vector, printN int) string
- func NameSpaceField(val string) zap.Field
- func NextGlobalSeqNum() uint64
- func OperandField(val any) zap.Field
- func OperandNameSpace() zap.Field
- func OperationField(val string) zap.Field
- func ReasonField(val string) zap.Field
- func RepeatStr(str string, times int) string
- func ReprerField(key string, val Reprer) zap.Field
- func RetryWithIntervalAndTimeout(op WaitOp, timeout time.Duration, interval time.Duration, suppressTimout bool) (err error)
- func RoaringToMOBitmap(bm *roaring.Bitmap) *nulls.Bitmap
- func ShortSegId(x types.Uuid) string
- func TimestampField(val any) zap.Field
- func TypeStringValue(t types.Type, v any, isNull bool, opts ...TypePrintOpt) string
- type ClosedInterval
- func (i *ClosedInterval) Append(id uint64) error
- func (i *ClosedInterval) AtomicUpdateEnd(v uint64)
- func (i *ClosedInterval) Contains(o ClosedInterval) bool
- func (i *ClosedInterval) GT(o *ClosedInterval) bool
- func (i *ClosedInterval) IsCoveredByInt(idx uint64) bool
- func (i *ClosedInterval) LT(o *ClosedInterval) bool
- func (i *ClosedInterval) String() string
- func (i *ClosedInterval) TryMerge(o ClosedInterval) bool
- func (i *ClosedInterval) Uint64Contains(start, end uint64) bool
- type ClosedIntervals
- func NewClosedIntervals() *ClosedIntervals
- func NewClosedIntervalsByInt(i uint64) *ClosedIntervals
- func NewClosedIntervalsByInterval(i *ClosedInterval) *ClosedIntervals
- func NewClosedIntervalsByIntervals(i *ClosedIntervals) *ClosedIntervals
- func NewClosedIntervalsBySlice(array []uint64) *ClosedIntervals
- func (intervals *ClosedIntervals) Contains(o ClosedIntervals) bool
- func (intervals *ClosedIntervals) ContainsInt(n uint64) bool
- func (intervals *ClosedIntervals) ContainsInterval(oIntervals ClosedInterval) bool
- func (intervals *ClosedIntervals) Equal(o *ClosedIntervals) bool
- func (intervals *ClosedIntervals) GetCardinality() int
- func (intervals *ClosedIntervals) GetMax() uint64
- func (intervals *ClosedIntervals) GetMin() uint64
- func (intervals *ClosedIntervals) IsCoveredByInt(i uint64) bool
- func (intervals *ClosedIntervals) ReadFrom(r io.Reader) (n int64, err error)
- func (intervals *ClosedIntervals) TryMerge(o ClosedIntervals)
- func (intervals *ClosedIntervals) WriteTo(w io.Writer) (n int64, err error)
- type DurationRecords
- type GenericDLNode
- type GenericSortedDList
- func (l *GenericSortedDList[T]) Delete(n *GenericDLNode[T])
- func (l *GenericSortedDList[T]) Depth() int
- func (l *GenericSortedDList[T]) GetHead() *GenericDLNode[T]
- func (l *GenericSortedDList[T]) GetTail() *GenericDLNode[T]
- func (l *GenericSortedDList[T]) Insert(payload T) *GenericDLNode[T]
- func (l *GenericSortedDList[T]) Loop(fn func(n *GenericDLNode[T]) bool, reverse bool)
- func (l *GenericSortedDList[T]) Update(n *GenericDLNode[T])
- type GenericSortedDListIt
- type ID
- type IRef
- type ISLLNode
- type ISSLLNode
- type IdAlloctor
- type MergeHistory
- type OnZeroCB
- type PPLevel
- type PinnedItem
- type RecordCtxKeyType
- type RefHelper
- type Reprer
- type RetryOp
- type RowGen
- type SLLNode
- type SSLLNode
- type TableCompactStat
- type TxnIDAllocator
- type TypePrintOpt
- type WaitOp
- type WithDoNotPrintBin
- type WithSpecialRowid
Constants ¶
const ( DefaultNotLoadMoreThan = 4096 DefaultMinRowsQualified = 40960 DefaultMaxMergeObjN = 4 )
const (
CloseIntervalSize int64 = int64(unsafe.Sizeof(ClosedInterval{}))
)
const DefaultMaxRowsToPrint = 3
Variables ¶
var ( RuntimeNotLoadMoreThan atomic.Int32 RuntimeMaxMergeObjN atomic.Int32 RuntimeMinRowsQualified atomic.Int32 )
var AnyField = zap.Any
var DefaultAllocator *mpool.MPool
A few allocators for TAE
var (
GlobalSeqNum atomic.Uint64
)
var MutMemAllocator *mpool.MPool
var SmallAllocator *mpool.MPool
var StringerField = zap.Stringer
Functions ¶
func BitmapEqual ¶ added in v0.8.0
func BlockIDArraryString ¶ added in v0.7.0
func CountField ¶
func DebugMoBatch ¶ added in v0.8.0
func DoIfDebugEnabled ¶ added in v0.8.0
func DoIfDebugEnabled(fn func())
func DoIfErrorEnabled ¶ added in v0.8.0
func DoIfErrorEnabled(fn func())
func DoIfFatalEnabled ¶ added in v0.8.0
func DoIfFatalEnabled(fn func())
func DoIfInfoEnabled ¶ added in v0.8.0
func DoIfInfoEnabled(fn func())
func DoIfWarnEnabled ¶ added in v0.8.0
func DoIfWarnEnabled(fn func())
func EncodeCloseInterval ¶ added in v0.8.0
func EncodeCloseInterval(i *ClosedInterval) []byte
func EntityField ¶
func ErrorField ¶
func ExceptionField ¶
func GetGlobalSeqNum ¶
func GetGlobalSeqNum() uint64
func HumanReadableBytes ¶ added in v1.0.0
func IDArraryString ¶
func InitTAEMPool ¶ added in v0.6.0
func InitTAEMPool()
func LoopGenericSortedDList ¶ added in v0.6.0
func LoopGenericSortedDList[T any](head *GenericDLNode[T], fn func(node *GenericDLNode[T]) bool, reverse bool)
Loop the list and apply fn on each node head is the head node of a list fn is operation applied to each node during iterating. if fn(node) returns false, stop iterating. reverse is true to loop in reversed way.
func MOOrRoaringBitmap ¶ added in v0.8.0
func NameSpaceField ¶
func NextGlobalSeqNum ¶
func NextGlobalSeqNum() uint64
func OperandField ¶
func OperandNameSpace ¶
func OperationField ¶
func ReasonField ¶
func RetryWithIntervalAndTimeout ¶ added in v0.7.0
func ShortSegId ¶ added in v1.0.0
func TimestampField ¶
func TypeStringValue ¶ added in v0.6.0
Types ¶
type ClosedInterval ¶
type ClosedInterval struct {
Start, End uint64
}
func (*ClosedInterval) Append ¶
func (i *ClosedInterval) Append(id uint64) error
func (*ClosedInterval) AtomicUpdateEnd ¶
func (i *ClosedInterval) AtomicUpdateEnd(v uint64)
func (*ClosedInterval) Contains ¶
func (i *ClosedInterval) Contains(o ClosedInterval) bool
func (*ClosedInterval) GT ¶
func (i *ClosedInterval) GT(o *ClosedInterval) bool
func (*ClosedInterval) IsCoveredByInt ¶
func (i *ClosedInterval) IsCoveredByInt(idx uint64) bool
func (*ClosedInterval) LT ¶
func (i *ClosedInterval) LT(o *ClosedInterval) bool
func (*ClosedInterval) String ¶
func (i *ClosedInterval) String() string
func (*ClosedInterval) TryMerge ¶
func (i *ClosedInterval) TryMerge(o ClosedInterval) bool
func (*ClosedInterval) Uint64Contains ¶ added in v1.0.0
func (i *ClosedInterval) Uint64Contains(start, end uint64) bool
type ClosedIntervals ¶
type ClosedIntervals struct {
Intervals []*ClosedInterval
}
func NewClosedIntervals ¶
func NewClosedIntervals() *ClosedIntervals
func NewClosedIntervalsByInt ¶
func NewClosedIntervalsByInt(i uint64) *ClosedIntervals
func NewClosedIntervalsByInterval ¶
func NewClosedIntervalsByInterval(i *ClosedInterval) *ClosedIntervals
func NewClosedIntervalsByIntervals ¶
func NewClosedIntervalsByIntervals(i *ClosedIntervals) *ClosedIntervals
func NewClosedIntervalsBySlice ¶
func NewClosedIntervalsBySlice(array []uint64) *ClosedIntervals
func (*ClosedIntervals) Contains ¶
func (intervals *ClosedIntervals) Contains(o ClosedIntervals) bool
func (*ClosedIntervals) ContainsInt ¶ added in v0.6.0
func (intervals *ClosedIntervals) ContainsInt(n uint64) bool
func (*ClosedIntervals) ContainsInterval ¶
func (intervals *ClosedIntervals) ContainsInterval(oIntervals ClosedInterval) bool
func (*ClosedIntervals) Equal ¶
func (intervals *ClosedIntervals) Equal(o *ClosedIntervals) bool
Equal is for test
func (*ClosedIntervals) GetCardinality ¶
func (intervals *ClosedIntervals) GetCardinality() int
func (*ClosedIntervals) GetMax ¶ added in v0.6.0
func (intervals *ClosedIntervals) GetMax() uint64
func (*ClosedIntervals) GetMin ¶ added in v0.6.0
func (intervals *ClosedIntervals) GetMin() uint64
func (*ClosedIntervals) IsCoveredByInt ¶
func (intervals *ClosedIntervals) IsCoveredByInt(i uint64) bool
func (*ClosedIntervals) ReadFrom ¶
func (intervals *ClosedIntervals) ReadFrom(r io.Reader) (n int64, err error)
func (*ClosedIntervals) TryMerge ¶
func (intervals *ClosedIntervals) TryMerge(o ClosedIntervals)
type DurationRecords ¶ added in v1.0.0
type GenericDLNode ¶ added in v0.6.0
type GenericDLNode[T any] struct { // contains filtered or unexported fields }
Doubly sorted linked-list node
func InsertGenericDLNode ¶ added in v0.6.0
func InsertGenericDLNode[T any](payload T, head *GenericDLNode[T], compare func(T, T) int) (node, nhead, ntail *GenericDLNode[T])
Insert a wrapped object into a list specified by a head node node is the inserted dlnode nhead is the new head node ntail is the new tail node. If ntail is not nil, tail is updated. Else tail is not updated
func (*GenericDLNode[T]) GetNext ¶ added in v0.6.0
func (l *GenericDLNode[T]) GetNext() *GenericDLNode[T]
func (*GenericDLNode[T]) GetPayload ¶ added in v0.6.0
func (l *GenericDLNode[T]) GetPayload() T
func (*GenericDLNode[T]) GetPrev ¶ added in v0.6.0
func (l *GenericDLNode[T]) GetPrev() *GenericDLNode[T]
func (*GenericDLNode[T]) KeepSorted ¶ added in v0.6.0
func (l *GenericDLNode[T]) KeepSorted(compare func(T, T) int) (head, tail *GenericDLNode[T])
Keep node be sorted in the list
type GenericSortedDList ¶ added in v0.6.0
type GenericSortedDList[T any] struct { // contains filtered or unexported fields }
Sorted doubly linked-list
func NewGenericSortedDList ¶ added in v0.6.0
func NewGenericSortedDList[T any](compare func(T, T) int) *GenericSortedDList[T]
func (*GenericSortedDList[T]) Delete ¶ added in v0.6.0
func (l *GenericSortedDList[T]) Delete(n *GenericDLNode[T])
Given a node and remove it from the list
Delete [node]
[prev node] <-> [node] <-> [next node] =============> [prev node] <-> [next node]
func (*GenericSortedDList[T]) Depth ¶ added in v0.6.0
func (l *GenericSortedDList[T]) Depth() int
Get the length of the list
func (*GenericSortedDList[T]) GetHead ¶ added in v0.6.0
func (l *GenericSortedDList[T]) GetHead() *GenericDLNode[T]
Get the head node
func (*GenericSortedDList[T]) GetTail ¶ added in v0.6.0
func (l *GenericSortedDList[T]) GetTail() *GenericDLNode[T]
Get the tail node
func (*GenericSortedDList[T]) Insert ¶ added in v0.6.0
func (l *GenericSortedDList[T]) Insert(payload T) *GenericDLNode[T]
Insert a object and wrap it as GenericDLNode into the list The inserted object must be instance of interface NodePayload [List]: [1,x1] <-> [5,x5] <-> [10,x10] Insert a node [7,x7] [List]: [1,x1] <-> [5,x5] <-> [7,x7] <-> [10,x10]
func (*GenericSortedDList[T]) Loop ¶ added in v0.6.0
func (l *GenericSortedDList[T]) Loop(fn func(n *GenericDLNode[T]) bool, reverse bool)
Loop the list and apply fn on each node
func (*GenericSortedDList[T]) Update ¶ added in v0.6.0
func (l *GenericSortedDList[T]) Update(n *GenericDLNode[T])
Update the node to keep the list be sorted
[List] [1,x1] <-> [3,x3] <-> [10,x10] <-> [20,x20]
|
[Node] [10,x10]
--------- UPDATE [10,x10] TO [2, x10]--------------
[List] [1,x1] <-> [2,x10] <-> [3,x3] <-> [20,x20]
type GenericSortedDListIt ¶ added in v0.6.0
type GenericSortedDListIt[T any] struct { // contains filtered or unexported fields }
Sorted doubly linked-list iterator
func NewGenericSortedDListIt ¶ added in v0.6.0
func NewGenericSortedDListIt[T any](linkLocker *sync.RWMutex, dlist *GenericSortedDList[T], reverse bool) *GenericSortedDListIt[T]
linkLocker is the outer locker to guard dlist access
func (*GenericSortedDListIt[T]) Get ¶ added in v0.6.0
func (it *GenericSortedDListIt[T]) Get() *GenericDLNode[T]
func (*GenericSortedDListIt[T]) Next ¶ added in v0.6.0
func (it *GenericSortedDListIt[T]) Next()
func (*GenericSortedDListIt[T]) Valid ¶ added in v0.6.0
func (it *GenericSortedDListIt[T]) Valid() bool
type ID ¶
type ID struct { // Internal db id DbID uint64 // Internal table id TableID uint64 // Internal block id BlockID types.Blockid }
ID is the general identifier type shared by different types like table, segment, block, etc.
We could wrap info from upper level via ID, for instance, get the table id, segment id, and the block id for one block by ID.AsBlockID, which made the resource management easier.
func (*ID) BlockString ¶
func (*ID) SegmentString ¶
func (*ID) SetSegmentID ¶ added in v0.8.0
func (*ID) TableString ¶
type IRef ¶
type IRef interface { RefCount() int64 // RefIfHasRef increment refcnt if existing cnt > 0 and return true, // return false if cnt is zero. Note: the udpate is atomic RefIfHasRef() bool Ref() Unref() }
IRef is the general representation of the resources that should be managed with a reference count. Once the reference count reached 0, the OnZeroCB would be called.
type IdAlloctor ¶
type IdAlloctor struct {
// contains filtered or unexported fields
}
func NewIdAlloctor ¶
func NewIdAlloctor(from uint64) *IdAlloctor
func (*IdAlloctor) Alloc ¶
func (alloc *IdAlloctor) Alloc() uint64
func (*IdAlloctor) Get ¶
func (alloc *IdAlloctor) Get() uint64
func (*IdAlloctor) SetStart ¶
func (alloc *IdAlloctor) SetStart(start uint64)
type MergeHistory ¶ added in v1.0.0
func (*MergeHistory) Add ¶ added in v1.0.0
func (h *MergeHistory) Add(osize, nobj, nblk int)
func (*MergeHistory) IsLastBefore ¶ added in v1.0.0
func (h *MergeHistory) IsLastBefore(d time.Duration) bool
func (*MergeHistory) String ¶ added in v1.0.1
func (h *MergeHistory) String() string
type PinnedItem ¶ added in v0.6.0
type PinnedItem[T IRef] struct { Val T }
func (*PinnedItem[T]) Close ¶ added in v0.6.0
func (item *PinnedItem[T]) Close()
func (*PinnedItem[T]) Item ¶ added in v0.6.0
func (item *PinnedItem[T]) Item() T
type RecordCtxKeyType ¶ added in v1.0.0
type RecordCtxKeyType string
var ActiveHandleCommit RecordCtxKeyType = "Active Handle Commit"
var ActiveHandleRequests RecordCtxKeyType = "Active Handle Requests"
var DequeuePrepared RecordCtxKeyType = "Dequeue Prepared"
var DequeuePreparing RecordCtxKeyType = "Dequeue Preparing"
var PrepareLogtail RecordCtxKeyType = "Prepare Logtail"
var PrepareWAL RecordCtxKeyType = "Prepare WAL"
var StoreApplyCommit RecordCtxKeyType = "Store Apply Commit"
var StorePreApplyCommit RecordCtxKeyType = "Store Pre Apply Commit"
var StorePrePrepare RecordCtxKeyType = "Store Pre Prepare"
var StorePrepareCommit RecordCtxKeyType = "Store Prepare Commit"
type RefHelper ¶
func (*RefHelper) RefIfHasRef ¶ added in v0.7.0
type SLLNode ¶
SLLNode represent a single node in linked list. It is thread-safe.
func NewSLLNode ¶
func (*SLLNode) GetNextNode ¶
func (*SLLNode) ReleaseNextNode ¶
func (l *SLLNode) ReleaseNextNode()
func (*SLLNode) SetNextNode ¶
func (*SLLNode) SetNextNodeNoLock ¶
type SSLLNode ¶
type SSLLNode struct {
// contains filtered or unexported fields
}
func NewSSLLNode ¶
func NewSSLLNode() *SSLLNode
func (*SSLLNode) ReleaseFollowing ¶
func (*SSLLNode) ReleaseNextNode ¶
type TableCompactStat ¶ added in v1.0.0
type TableCompactStat struct { sync.RWMutex Inited bool // how often to flush table tail // this duration will be add some random value to avoid flush many tables at the same time FlushGapDuration time.Duration // if the size of table tail, in bytes, exceeds FlushMemCapacity, flush it immediately FlushMemCapacity int // dirty end range flushed by last flush txn. If we are waiting for a ckp [a, b], and all dirty tables' LastFlush are greater than b, // the checkpoint is ready to collect data and write all down. LastFlush types.TS // FlushDeadline is the deadline to flush table tail FlushDeadline time.Time MergeHist MergeHistory }
func (*TableCompactStat) AddMerge ¶ added in v1.0.0
func (s *TableCompactStat) AddMerge(osize, nobj, nblk int)
func (*TableCompactStat) GetLastFlush ¶ added in v1.0.1
func (s *TableCompactStat) GetLastFlush() types.TS
func (*TableCompactStat) GetLastMerge ¶ added in v1.0.0
func (s *TableCompactStat) GetLastMerge() *MergeHistory
func (*TableCompactStat) InitWithLock ¶ added in v1.0.0
func (s *TableCompactStat) InitWithLock(durationHint time.Duration)
func (*TableCompactStat) ResetDeadlineWithLock ¶ added in v1.0.0
func (s *TableCompactStat) ResetDeadlineWithLock()
type TxnIDAllocator ¶ added in v0.6.0
type TxnIDAllocator struct { }
func NewTxnIDAllocator ¶ added in v0.6.0
func NewTxnIDAllocator() *TxnIDAllocator
func (*TxnIDAllocator) Alloc ¶ added in v0.6.0
func (alloc *TxnIDAllocator) Alloc() []byte
type TypePrintOpt ¶ added in v0.6.0
type TypePrintOpt interface {
// contains filtered or unexported methods
}
type WithDoNotPrintBin ¶ added in v0.6.0
type WithDoNotPrintBin struct{}
type WithSpecialRowid ¶ added in v0.6.0
type WithSpecialRowid struct{}