Documentation
¶
Overview ¶
Copyright 2021 Matrix Origin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddMergeTrace(id uint64)
- func AttrFromColDef(col *ColDef) (attrs *engine.Attribute, err error)
- func CheckMergeTrace(id uint64) (in bool)
- func CmdName(t uint16) string
- func CompareBaseNode[T BaseNode[T]](e, o *MVCCNode[T]) int
- func EncodeAccessInfo(ai *accessInfo) []byte
- func EncodeBlockNode(node *BlockNode) []byte
- func EncodeEntryMVCCNode(node *EntryMVCCNode) []byte
- func GetAttrIdx(attrs []string, name string) int
- func InputObjectZapFields(tid uint64, stats *objectio.ObjectStats, createTime types.TS, isTombstone bool) []zap.Field
- func LevelDistToZapFields(levelDist []LevelDist) []zap.Field
- func LogInputDataObject(table *TableEntry, stats *objectio.ObjectStats, createTime types.TS)
- func LogInputTombstoneObjectAsync(table *TableEntry, stats *objectio.ObjectStats, createTime types.TS, ...)
- func LogInputTombstoneObjectWithExistingBatches(table *TableEntry, stats *objectio.ObjectStats, createTime types.TS, ...)
- func MockBatch(schema *Schema, rows int) *containers.Batch
- func MockTxnFactory(catalog *Catalog) txnbase.TxnFactory
- func MockTxnStoreFactory(catalog *Catalog) txnbase.TxnStoreFactory
- func NewCNTombstoneBatchByPKType(pkType types.Type, mp *mpool.MPool) *containers.Batch
- func NewEmptyMVCCNodeFactory[T BaseNode[T]](factory func() T) func() *MVCCNode[T]
- func NewTombstoneBatchByPKType(pkType types.Type, mp *mpool.MPool) *containers.Batch
- func NewTombstoneBatchWithPKVector(pkVec, rowIDVec containers.Vector, mp *mpool.MPool) *containers.Batch
- func ObjectValid(objectEntry *ObjectEntry) bool
- func RemoveMergeTrace(id uint64)
- func SchemaToDefs(schema *Schema) (defs []engine.TableDef, err error)
- type BaseEntry
- type BaseEntryImpl
- func (be *BaseEntryImpl[T]) ConflictCheck(txn txnif.TxnReader) (err error)
- func (be *BaseEntryImpl[T]) CreateWithTSLocked(ts types.TS, baseNode T)
- func (be *BaseEntryImpl[T]) CreateWithTxnLocked(txn txnif.AsyncTxn, baseNode T)
- func (be *BaseEntryImpl[T]) DeleteAfter(ts types.TS) bool
- func (be *BaseEntryImpl[T]) DeleteBefore(ts types.TS) bool
- func (be *BaseEntryImpl[T]) DeleteBeforeLocked(ts types.TS) bool
- func (be *BaseEntryImpl[T]) DeleteLocked(txn txnif.TxnReader) (isNewNode bool, err error)
- func (be *BaseEntryImpl[T]) DropEntryLocked(txn txnif.TxnReader) (isNewNode bool, err error)
- func (be *BaseEntryImpl[T]) GetCreatedAtLocked() types.TS
- func (be *BaseEntryImpl[T]) GetDeleteAtLocked() types.TS
- func (be *BaseEntryImpl[T]) GetVisibility(txn txnif.TxnReader) (visible, dropped bool)
- func (be *BaseEntryImpl[T]) GetVisibilityLocked(txn txnif.TxnReader) (visible, dropped bool)
- func (be *BaseEntryImpl[T]) HasDropCommitted() bool
- func (be *BaseEntryImpl[T]) HasDropCommittedLocked() bool
- func (be *BaseEntryImpl[T]) IsVisibleWithLock(txn txnif.TxnReader, mu *sync.RWMutex) (ok bool, err error)
- func (be *BaseEntryImpl[T]) NeedWaitCommittingLocked(startTS types.TS) (bool, txnif.TxnReader)
- func (be *BaseEntryImpl[T]) PPStringLocked(level common.PPLevel, depth int, prefix string) string
- func (be *BaseEntryImpl[T]) PrepareAdd(txn txnif.TxnReader) (err error)
- func (be *BaseEntryImpl[T]) String() string
- func (be *BaseEntryImpl[T]) StringLocked() string
- type BaseNode
- type BlockNode
- type Catalog
- func (catalog *Catalog) AddEntryLocked(database *DBEntry, txn txnif.TxnReader, skipDedup bool) error
- func (catalog *Catalog) CheckMetadata()
- func (catalog *Catalog) Close() error
- func (catalog *Catalog) CreateDBEntry(name, createSql, datTyp string, txn txnif.AsyncTxn) (*DBEntry, error)
- func (catalog *Catalog) CreateDBEntryWithID(name, createSql, datTyp string, id uint64, txn txnif.AsyncTxn) (*DBEntry, error)
- func (catalog *Catalog) DropDBEntry(entry *DBEntry, txn txnif.AsyncTxn) (isNewMVCCNode bool, err error)
- func (catalog *Catalog) DropDBEntryByID(id uint64, txn txnif.AsyncTxn) (isNewMVCCNode bool, deleted *DBEntry, err error)
- func (catalog *Catalog) DropDBEntryByName(name string, txn txnif.AsyncTxn) (isNewMVCCNode bool, deleted *DBEntry, err error)
- func (catalog *Catalog) GCByTS(ctx context.Context, ts types.TS)
- func (catalog *Catalog) GetDatabaseByID(id uint64) (db *DBEntry, err error)
- func (catalog *Catalog) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*DBEntry]
- func (catalog *Catalog) GetUsageMemo() any
- func (catalog *Catalog) InitSource() iter.Seq[MergeTable]
- func (catalog *Catalog) InitSystemDB()
- func (catalog *Catalog) MakeDBIt(reverse bool) *common.GenericSortedDListIt[*DBEntry]
- func (catalog *Catalog) OnReplayObjectBatch(replayer ObjectListReplayer, objectInfo *containers.Batch, isTombstone bool, ...)
- func (catalog *Catalog) OnReplayObjectBatch_V2(dbid, tid uint64, objectType int8, stats objectio.ObjectStats, ...)
- func (catalog *Catalog) PPString(level common.PPLevel, depth int, prefix string) string
- func (catalog *Catalog) RecurLoop(processor Processor) (err error)
- func (catalog *Catalog) RelayFromSysTableObjects(ctx context.Context, readTxn txnif.AsyncTxn, ...) (closeCB []func())
- func (catalog *Catalog) RemoveDBEntry(database *DBEntry) error
- func (catalog *Catalog) ReplayCmd(txncmd txnif.TxnCmd, observer wal.ReplayObserver)
- func (catalog *Catalog) ReplayMODatabase(ctx context.Context, txnNode *txnbase.TxnMVCCNode, bat *containers.Batch)
- func (catalog *Catalog) ReplayMOTables(ctx context.Context, txnNode *txnbase.TxnMVCCNode, ...)
- func (catalog *Catalog) ReplayTableRows()
- func (catalog *Catalog) SetMergeNotifier(notifier MergeNotifierOnCatalog)
- func (catalog *Catalog) SetUsageMemo(memo any)
- func (catalog *Catalog) SimplePPString(level common.PPLevel) string
- func (catalog *Catalog) TxnGetDBEntryByID(id uint64, txn txnif.AsyncTxn) (*DBEntry, error)
- func (catalog *Catalog) TxnGetDBEntryByName(name string, txn txnif.AsyncTxn) (*DBEntry, error)
- type CatalogEventSource
- type ColDef
- func (def *ColDef) ApproxSize() int64
- func (def *ColDef) GetName() string
- func (def *ColDef) GetType() types.Type
- func (def *ColDef) IsAutoIncrement() bool
- func (def *ColDef) IsClusterBy() bool
- func (def *ColDef) IsCompositeColumn() bool
- func (def *ColDef) IsHidden() bool
- func (def *ColDef) IsPhyAddr() bool
- func (def *ColDef) IsPrimary() bool
- func (def *ColDef) IsRealPrimary() bool
- func (def *ColDef) IsSortKey() bool
- func (def *ColDef) Nullable() bool
- type DBEntry
- func (e *DBEntry) AddEntryLocked(table *TableEntry, txn txnif.TxnReader, skipDedup bool) (err error)
- func (e *DBEntry) AsCommonID() *common.ID
- func (e *DBEntry) CoarseTableCnt() int
- func (e *DBEntry) CreateTableEntry(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory) (created *TableEntry, err error)
- func (e *DBEntry) CreateTableEntryWithTableId(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory, ...) (created *TableEntry, err error)
- func (e *DBEntry) DropTableEntry(name string, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)
- func (e *DBEntry) DropTableEntryByID(id uint64, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)
- func (e *DBEntry) GetCatalog() *Catalog
- func (e *DBEntry) GetCreateAt() types.Timestamp
- func (e *DBEntry) GetCreateSql() string
- func (e *DBEntry) GetDatType() string
- func (e *DBEntry) GetFullName() string
- func (e *DBEntry) GetID() uint64
- func (e *DBEntry) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*TableEntry]
- func (e *DBEntry) GetName() string
- func (e *DBEntry) GetObjectEntryByID(id *common.ID, isTombstone bool) (obj *ObjectEntry, err error)
- func (e *DBEntry) GetRoleID() uint32
- func (e *DBEntry) GetTableEntryByID(id uint64) (table *TableEntry, err error)
- func (e *DBEntry) GetTableEntryByName(tenantID uint32, name string, txn txnif.TxnReader) (entry *TableEntry, err error)
- func (e *DBEntry) GetTenantID() uint32
- func (e *DBEntry) GetUserID() uint32
- func (e *DBEntry) IsActive() bool
- func (e *DBEntry) IsSubscription() bool
- func (e *DBEntry) IsSystemDB() bool
- func (e *DBEntry) Less(b *DBEntry) int
- func (e *DBEntry) MakeCommand(id uint32) (txnif.TxnCmd, error)
- func (e *DBEntry) MakeTableIt(reverse bool) *common.GenericSortedDListIt[*TableEntry]
- func (e *DBEntry) PPString(level common.PPLevel, depth int, prefix string) string
- func (e *DBEntry) PrepareRollback() (err error)
- func (e *DBEntry) PrettyNameIndex() string
- func (e *DBEntry) RecurLoop(processor Processor) (err error)
- func (e *DBEntry) RemoveEntry(table *TableEntry) (err error)
- func (e *DBEntry) RenameTableInTxn(old, new string, tid uint64, tenantID uint32, txn txnif.TxnReader, first bool) error
- func (e *DBEntry) RollbackRenameTable(fullname string, tid uint64)
- func (e *DBEntry) String() string
- func (e *DBEntry) StringLocked() string
- func (e *DBEntry) StringWithLevel(level common.PPLevel) string
- func (e *DBEntry) StringWithlevelLocked(level common.PPLevel) string
- func (e *DBEntry) TestSetCatalog(catalog *Catalog)
- func (e *DBEntry) TxnGetTableEntryByID(id uint64, txn txnif.AsyncTxn) (entry *TableEntry, err error)
- func (e *DBEntry) TxnGetTableEntryByName(name string, txn txnif.AsyncTxn) (entry *TableEntry, err error)
- type DBNode
- type DataFactory
- type EmptyMVCCNode
- func (e *EmptyMVCCNode) ApproxSize() int64
- func (e *EmptyMVCCNode) CloneAll() *EmptyMVCCNode
- func (e *EmptyMVCCNode) CloneData() *EmptyMVCCNode
- func (e *EmptyMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (e *EmptyMVCCNode) String() string
- func (e *EmptyMVCCNode) Update(vun *EmptyMVCCNode)
- func (e *EmptyMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type EntryCommand
- func (cmd *EntryCommand[T, N]) ApplyCommit()
- func (cmd *EntryCommand[T, N]) ApplyRollback()
- func (cmd *EntryCommand[T, N]) ApproxSize() int64
- func (cmd *EntryCommand[T, N]) Desc() string
- func (cmd *EntryCommand[T, N]) GetCurrVersion() uint16
- func (cmd *EntryCommand[T, N]) GetID() *common.ID
- func (cmd *EntryCommand[T, N]) GetMVCCNode() *MVCCNode[T]
- func (cmd *EntryCommand[T, N]) GetTs() types.TS
- func (cmd *EntryCommand[T, N]) GetType() uint16
- func (cmd *EntryCommand[T, N]) IDString() string
- func (cmd *EntryCommand[T, N]) MarshalBinary() (buf []byte, err error)
- func (cmd *EntryCommand[T, N]) MarshalBinaryWithBuffer(buf *bytes.Buffer) error
- func (cmd *EntryCommand[T, N]) ReadFrom(r io.Reader) (n int64, err error)
- func (cmd *EntryCommand[T, N]) SetReplayTxn(txn txnif.AsyncTxn)
- func (cmd *EntryCommand[T, N]) String() string
- func (cmd *EntryCommand[T, N]) UnmarshalBinary(buf []byte) (err error)
- func (cmd *EntryCommand[T, N]) VerboseString() string
- func (cmd *EntryCommand[T, N]) WriteTo(w io.Writer) (n int64, err error)
- type EntryMVCCNode
- func (un EntryMVCCNode) AppendObjectTuple(bat *containers.Batch, create bool)
- func (un EntryMVCCNode) AppendTupleWithCommitTS(bat *containers.Batch, ts types.TS)
- func (un *EntryMVCCNode) ApplyCommit(ts types.TS) (err error)
- func (un EntryMVCCNode) Clone() EntryMVCCNode
- func (un *EntryMVCCNode) Delete()
- func (un EntryMVCCNode) GetCreatedAt() types.TS
- func (un EntryMVCCNode) GetDeletedAt() types.TS
- func (un EntryMVCCNode) HasDropCommitted() bool
- func (un EntryMVCCNode) HasDropIntent() bool
- func (un EntryMVCCNode) IsCreating() bool
- func (un EntryMVCCNode) PrepareCommit() (err error)
- func (un *EntryMVCCNode) ReadFrom(r io.Reader) (n int64, err error)
- func (un EntryMVCCNode) String() string
- func (un EntryMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type EntryState
- type IDAllocator
- func (alloc *IDAllocator) CurrBlock() uint64
- func (alloc *IDAllocator) CurrDB() uint64
- func (alloc *IDAllocator) CurrObject() uint64
- func (alloc *IDAllocator) CurrTable() uint64
- func (alloc *IDAllocator) IDStates() string
- func (alloc *IDAllocator) Init(prevDb, prevTbl, prevObj, prevBlk uint64)
- func (alloc *IDAllocator) NextBlock() uint64
- func (alloc *IDAllocator) NextDB() uint64
- func (alloc *IDAllocator) NextObject() uint64
- func (alloc *IDAllocator) NextTable() uint64
- func (alloc *IDAllocator) OnReplayBlockID(id uint64)
- func (alloc *IDAllocator) OnReplayDBID(id uint64)
- func (alloc *IDAllocator) OnReplayObjectID(id uint64)
- func (alloc *IDAllocator) OnReplayTableID(id uint64)
- type LevelDist
- type LoopProcessor
- func (p *LoopProcessor) OnDatabase(database *DBEntry) error
- func (p *LoopProcessor) OnObject(Object *ObjectEntry) error
- func (p *LoopProcessor) OnPostDatabase(database *DBEntry) error
- func (p *LoopProcessor) OnPostObject(Object *ObjectEntry) error
- func (p *LoopProcessor) OnPostTable(table *TableEntry) error
- func (p *LoopProcessor) OnTable(table *TableEntry) error
- func (p *LoopProcessor) OnTombstone(tombstone *ObjectEntry) error
- type MVCCNode
- func (e *MVCCNode[T]) ApplyCommit(id string) (err error)
- func (e *MVCCNode[T]) ApplyRollback() (err error)
- func (e *MVCCNode[T]) ApproxSize() int64
- func (e *MVCCNode[T]) CloneAll() *MVCCNode[T]
- func (e *MVCCNode[T]) CloneData() *MVCCNode[T]
- func (e *MVCCNode[T]) IsNil() bool
- func (e *MVCCNode[T]) PrepareCommit() (err error)
- func (e *MVCCNode[T]) PrepareRollback() (err error)
- func (e *MVCCNode[T]) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (e *MVCCNode[T]) String() string
- func (e *MVCCNode[T]) Update(un *MVCCNode[T])
- func (e *MVCCNode[T]) WriteTo(w io.Writer) (n int64, err error)
- type MergeDataItem
- type MergeNotifierOnCatalog
- type MergeTable
- type MergeTombstoneItem
- type MetadataMVCCNode
- func (e *MetadataMVCCNode) ApproxSize() int64
- func (e *MetadataMVCCNode) CloneAll() *MetadataMVCCNode
- func (e *MetadataMVCCNode) CloneData() *MetadataMVCCNode
- func (e *MetadataMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (e *MetadataMVCCNode) String() string
- func (e *MetadataMVCCNode) Update(un *MetadataMVCCNode)
- func (e *MetadataMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type Node
- type ObjectDataFactory
- type ObjectEntry
- func IsTableTailFlushed(table *TableEntry, start, end types.TS, isTombstone bool) (bool, *ObjectEntry)
- func MockCreatedObjectEntry2List(rel *TableEntry, catalog *Catalog, isTombstone bool, create types.TS) *ObjectEntry
- func MockDroppedObjectEntry2List(created *ObjectEntry, delete types.TS) *ObjectEntry
- func MockObjEntryWithTbl(tbl *TableEntry, size uint64, isTombstone bool) *ObjectEntry
- func MockObjectEntry(tbl *TableEntry, stats *objectio.ObjectStats, isTombstone bool, ...) *ObjectEntry
- func NewObjectEntry(table *TableEntry, txn txnif.AsyncTxn, stats objectio.ObjectStats, ...) *ObjectEntry
- func NewReplayObjectEntry() *ObjectEntry
- func NewStandaloneObject(table *TableEntry, ts types.TS, isTombstone bool) *ObjectEntry
- func (entry *ObjectEntry) ApplyCommit(tid string) error
- func (entry *ObjectEntry) ApplyRollback() error
- func (entry *ObjectEntry) AsCommonID() *common.ID
- func (entry *ObjectEntry) BlockCnt() int
- func (entry *ObjectEntry) CheckPrintPrepareCompact() bool
- func (entry *ObjectEntry) CheckPrintPrepareCompactLocked(duration time.Duration) bool
- func (entry *ObjectEntry) Clone() *ObjectEntry
- func (entry *ObjectEntry) DeleteBefore(ts types.TS) bool
- func (entry *ObjectEntry) ForeachMVCCNodeInRange(start, end types.TS, f func(*txnbase.TxnMVCCNode) error) error
- func (entry *ObjectEntry) GetCommandMVCCNode() *MVCCNode[*ObjectMVCCNode]
- func (entry *ObjectEntry) GetCreatedAt() types.TS
- func (entry *ObjectEntry) GetDeleteAt() types.TS
- func (entry *ObjectEntry) GetDropEntry(txn txnif.TxnReader) (dropped *ObjectEntry, updatedCEntry *ObjectEntry, isNewNode bool)
- func (entry *ObjectEntry) GetLastMVCCNode() *txnbase.TxnMVCCNode
- func (entry *ObjectEntry) GetLatestCommittedNode() *txnbase.TxnMVCCNode
- func (entry *ObjectEntry) GetLatestNode() *ObjectEntry
- func (entry *ObjectEntry) GetLoaded() bool
- func (entry *ObjectEntry) GetLocation() objectio.Location
- func (entry *ObjectEntry) GetNextVersion() *ObjectEntry
- func (entry *ObjectEntry) GetNonAppendableBlockCnt() int
- func (entry *ObjectEntry) GetObjectData() data.Object
- func (entry *ObjectEntry) GetObjectStats() (stats *objectio.ObjectStats)
- func (entry *ObjectEntry) GetPrevVersion() *ObjectEntry
- func (entry *ObjectEntry) GetSchema() *Schema
- func (entry *ObjectEntry) GetTable() *TableEntry
- func (entry *ObjectEntry) GetUpdateEntry(txn txnif.TxnReader, stats *objectio.ObjectStats) (dropped *ObjectEntry, updatedCEntry *ObjectEntry, isNewNode bool)
- func (entry *ObjectEntry) HasCommittedPersistedData() bool
- func (entry *ObjectEntry) HasDCounterpart() bool
- func (entry *ObjectEntry) HasDropCommitted() bool
- func (entry *ObjectEntry) HasDropIntent() bool
- func (entry *ObjectEntry) HasPersistedData() bool
- func (entry *ObjectEntry) ID() *objectio.ObjectId
- func (entry *ObjectEntry) InitData(factory DataFactory)
- func (entry *ObjectEntry) IsActive() bool
- func (entry *ObjectEntry) IsAppendable() bool
- func (entry *ObjectEntry) IsCEntry() bool
- func (entry *ObjectEntry) IsCommitted() bool
- func (entry *ObjectEntry) IsCreatingOrAborted() bool
- func (entry *ObjectEntry) IsDEntry() bool
- func (entry *ObjectEntry) IsForcePNode() bool
- func (entry *ObjectEntry) IsSorted() bool
- func (entry *ObjectEntry) IsVisible(txn txnif.TxnReader) bool
- func (entry *ObjectEntry) Less(b *ObjectEntry) bool
- func (entry *ObjectEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)
- func (entry *ObjectEntry) ObjectPersisted() bool
- func (entry *ObjectEntry) PPString(level common.PPLevel, depth int, prefix string) string
- func (entry *ObjectEntry) PrepareCommit() error
- func (entry *ObjectEntry) PrepareCompact() bool
- func (entry *ObjectEntry) PrepareCompactLocked() bool
- func (entry *ObjectEntry) PrepareRollback() (err error)
- func (entry *ObjectEntry) PrintPrepareCompactDebugLog()
- func (entry *ObjectEntry) Repr() string
- func (entry *ObjectEntry) StatsString(zonemapKind common.ZonemapPrintKind) string
- func (entry *ObjectEntry) String() string
- func (entry *ObjectEntry) StringWithLevel(level common.PPLevel) string
- func (entry *ObjectEntry) TreeMaxDropCommitEntry() (BaseEntry, *ObjectEntry)
- func (entry *ObjectEntry) UpdateObjectInfo(txn txnif.TxnReader, stats *objectio.ObjectStats) (isNewNode bool, err error)
- func (entry *ObjectEntry) VisibleByTS(ts types.TS) bool
- type ObjectList
- func (l *ObjectList) DeleteAllEntries(id *objectio.ObjectId) error
- func (l *ObjectList) DropObjectByID(objectID *objectio.ObjectId, txn txnif.TxnReader) (droppedObj *ObjectEntry, isNew bool, err error)
- func (l *ObjectList) GetAllNodes(id *objectio.ObjectId) []*ObjectEntry
- func (l *ObjectList) GetLastestNode(id *objectio.ObjectId) *ObjectEntry
- func (l *ObjectList) GetObjectByID(objectID *objectio.ObjectId) (obj *ObjectEntry, err error)
- func (l *ObjectList) MakeVisibleCommittedObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
- func (l *ObjectList) Set(object *ObjectEntry)
- func (l *ObjectList) Show() string
- func (l *ObjectList) UpdateObjectInfo(obj *ObjectEntry, txn txnif.TxnReader, stats *objectio.ObjectStats) (isNew bool, err error)
- func (l *ObjectList) UpdateReplayTs(id *objectio.ObjectId, ts types.TS)
- func (l *ObjectList) WaitUntilCommitted(ts types.TS)
- type ObjectListReplayer
- type ObjectMVCCNode
- func NewEmptyObjectMVCCNode() *ObjectMVCCNode
- func NewObjectInfoWithMetaLocation(metaLoc objectio.Location, id *objectio.ObjectId) *ObjectMVCCNode
- func NewObjectInfoWithObjectID(id *objectio.ObjectId) *ObjectMVCCNode
- func NewObjectInfoWithObjectStats(stats *objectio.ObjectStats) *ObjectMVCCNode
- func ReadObjectInfoTuple(objs *vector.Vector, row int) (e *ObjectMVCCNode)
- func (e *ObjectMVCCNode) AppendTuple(sid *types.Objectid, batch *containers.Batch)
- func (e *ObjectMVCCNode) ApproxSize() int64
- func (e *ObjectMVCCNode) CloneAll() *ObjectMVCCNode
- func (e *ObjectMVCCNode) CloneData() *ObjectMVCCNode
- func (e *ObjectMVCCNode) IsEmpty() bool
- func (e *ObjectMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (e *ObjectMVCCNode) String() string
- func (e *ObjectMVCCNode) Update(vun *ObjectMVCCNode)
- func (e *ObjectMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type ObjectNode
- type Processor
- type Schema
- func DefsToSchema(name string, defs []engine.TableDef) (schema *Schema, err error)
- func GetTombstoneSchema(objectSchema *Schema) *Schema
- func MockSchema(colCnt int, pkIdx int) *Schema
- func MockSchemaAll(colCnt int, pkIdx int, from ...int) *Schema
- func MockSchemaAll2(colCnt int, pkIdxs []int, from ...int) *Schema
- func MockSchemaEnhanced(colCnt int, pkIdx int, from int) *Schema
- func MockSnapShotSchema() *Schema
- func NewEmptySchema(name string) *Schema
- func (s *Schema) AllNames() []string
- func (s *Schema) AllSeqnums() []uint16
- func (s *Schema) AllTypes() []types.Type
- func (s *Schema) AppendCol(name string, typ types.Type) error
- func (s *Schema) AppendColDef(def *ColDef) (err error)
- func (s *Schema) AppendColWithAttribute(attr engine.Attribute) error
- func (s *Schema) AppendFakePKCol() error
- func (s *Schema) AppendPKCol(name string, typ types.Type, idx int) error
- func (s *Schema) AppendSortColWithAttribute(attr engine.Attribute, sorIdx int, isPrimary bool) error
- func (s *Schema) AppendSortKey(name string, typ types.Type, idx int, isPrimary bool) error
- func (s *Schema) ApplyAlterTable(req *apipb.AlterTableReq) error
- func (s *Schema) ApproxSize() int64
- func (s *Schema) Attrs() []string
- func (s *Schema) Clone() *Schema
- func (s *Schema) EstimateRowSize() (size int)
- func (s *Schema) Finalize(withoutPhyAddr bool) (err error)
- func (s *Schema) GetColIdx(attr string) int
- func (s *Schema) GetPrimaryKey() *ColDef
- func (s *Schema) GetSeqnum(attr string) uint16
- func (s *Schema) GetSingleSortKey() *ColDef
- func (s *Schema) GetSingleSortKeyIdx() int
- func (s *Schema) GetSingleSortKeyType() types.Type
- func (s *Schema) HasFakePK() bool
- func (s *Schema) HasPK() bool
- func (s *Schema) HasPKOrFakePK() bool
- func (s *Schema) HasSortKey() bool
- func (s *Schema) IsSameColumns(other *Schema) bool
- func (s *Schema) IsSecondaryIndexTable() bool
- func (s *Schema) Marshal() (buf []byte, err error)
- func (s *Schema) MustGetExtraBytes() []byte
- func (s *Schema) MustRestoreExtra(data []byte)
- func (s *Schema) ReadFromBatch(bat *containers.Batch, tids []uint64, ...) (next int)
- func (s *Schema) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (s *Schema) String() string
- func (s *Schema) Types() []types.Type
- type SortKey
- type TNMergeTable
- type TNTombstoneItem
- type TableDataFactory
- type TableEntry
- func MockStaloneTableEntry(id uint64, schema *Schema) *TableEntry
- func MockTableEntryWithDB(dbEntry *DBEntry, tblId uint64) *TableEntry
- func NewReplayTableEntry() *TableEntry
- func NewSystemTableEntry(db *DBEntry, id uint64, schema *Schema) *TableEntry
- func NewTableEntry(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, ...) *TableEntry
- func NewTableEntryWithTableId(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, ...) *TableEntry
- func (entry *TableEntry) AddEntryLocked(objectEntry *ObjectEntry)
- func (entry *TableEntry) AddRows(delta uint64) uint64
- func (entry *TableEntry) AlterTable(ctx context.Context, txn txnif.TxnReader, req *apipb.AlterTableReq) (isNewNode bool, newSchema *Schema, err error)
- func (entry *TableEntry) ApplyCommit(id string) (err error)
- func (entry *TableEntry) AsCommonID() *common.ID
- func (entry *TableEntry) CreateObject(txn txnif.AsyncTxn, opts *objectio.CreateObjOpt, dataFactory ObjectDataFactory) (created *ObjectEntry, err error)
- func (entry *TableEntry) CreateWithTxnAndSchema(txn txnif.AsyncTxn, schema *Schema)
- func (entry *TableEntry) DropObjectEntry(id *types.Objectid, txn txnif.AsyncTxn, isTombstone bool) (deleted *ObjectEntry, err error)
- func (entry *TableEntry) FreezeAppend()
- func (entry *TableEntry) GetCatalog() *Catalog
- func (entry *TableEntry) GetColDefs() []*ColDef
- func (entry *TableEntry) GetDB() *DBEntry
- func (entry *TableEntry) GetFullName() string
- func (entry *TableEntry) GetID() uint64
- func (entry *TableEntry) GetLastestSchema(isTombstone bool) *Schema
- func (entry *TableEntry) GetLastestSchemaLocked(isTombstone bool) *Schema
- func (entry *TableEntry) GetNameDesc() string
- func (entry *TableEntry) GetObjectByID(id *types.Objectid, isTombstone bool) (obj *ObjectEntry, err error)
- func (entry *TableEntry) GetRows() uint64
- func (entry *TableEntry) GetSoftdeleteObjects(dedupedTS, collectTS types.TS) (objs []*ObjectEntry)
- func (entry *TableEntry) GetTableData() data.Table
- func (entry *TableEntry) GetVersionSchema(ver uint32) *Schema
- func (entry *TableEntry) GetVisibilityAndName(txn txnif.TxnReader) (visible, dropped bool, name string)
- func (entry *TableEntry) GetVisibleSchema(txn txnif.TxnReader, isTombstone bool) (schema *Schema)
- func (entry *TableEntry) IsActive() bool
- func (entry *TableEntry) IsTableTailFlushed(start, end types.TS) (bool, *ObjectEntry)
- func (entry *TableEntry) IsVirtual() bool
- func (entry *TableEntry) Less(b *TableEntry) int
- func (entry *TableEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)
- func (entry *TableEntry) MakeDataObjectIt() btree.IterG[*ObjectEntry]
- func (entry *TableEntry) MakeDataVisibleObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
- func (entry *TableEntry) MakeTombstoneObjectIt() btree.IterG[*ObjectEntry]
- func (entry *TableEntry) MakeTombstoneVisibleObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
- func (entry *TableEntry) ObjectCnt(isTombstone bool) int
- func (entry *TableEntry) ObjectStats(level common.PPLevel, start, end int, isTombstone bool) (stat TableStat, w bytes.Buffer)
- func (entry *TableEntry) ObjectStatsString(level common.PPLevel, start, end int, isTombstone bool) string
- func (entry *TableEntry) PPString(level common.PPLevel, depth int, prefix string) string
- func (entry *TableEntry) PrepareRollback() (err error)
- func (entry *TableEntry) RecurLoop(processor Processor) (err error)
- func (entry *TableEntry) RemoveEntry(objectEntry *ObjectEntry) (err error)
- func (entry *TableEntry) RemoveRows(delta uint64) uint64
- func (entry *TableEntry) ShowObjectList(isTombstone bool) string
- func (entry *TableEntry) String() string
- func (entry *TableEntry) StringLocked() string
- func (entry *TableEntry) StringLockedWithLevel(level common.PPLevel) string
- func (entry *TableEntry) StringWithLevel(level common.PPLevel) string
- func (entry *TableEntry) TryFindLastAppendableObject(isTombstone bool) (obj *ObjectEntry)
- func (entry *TableEntry) UpdateReplayEntryTs(objectEntry *ObjectEntry, ts types.TS)
- func (entry *TableEntry) WaitDataObjectCommitted(ts types.TS)
- func (entry *TableEntry) WaitTombstoneObjectCommitted(ts types.TS)
- type TableMVCCNode
- func (e *TableMVCCNode) ApproxSize() int64
- func (e *TableMVCCNode) CloneAll() *TableMVCCNode
- func (e *TableMVCCNode) CloneData() *TableMVCCNode
- func (e *TableMVCCNode) GetTombstoneSchema() *Schema
- func (e *TableMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (e *TableMVCCNode) String() string
- func (e *TableMVCCNode) Update(un *TableMVCCNode)
- func (e *TableMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type TableNode
- type TableStat
- type VisibleCommittedObjectIt
Constants ¶
const ( SnapshotAttr_TID = "table_id" SnapshotAttr_DBID = "db_id" ObjectAttr_ObjectStats = "object_stats" EntryNode_CreateAt = "create_at" EntryNode_DeleteAt = "delete_at" )
+--------+---------+----------+----------+------------+ | ID | Name | CreateAt | DeleteAt | CommitInfo | +--------+---------+----------+----------+------------+ |(uint64)|(varchar)| (uint64) | (uint64) | (varchar) | +--------+---------+----------+----------+------------+
const ( State_Active = iota State_PrepareCommit State_ApplyCommit State_Empty )
const ( IOET_WALTxnCommand_Database uint16 = 3009 IOET_WALTxnCommand_Table uint16 = 3010 IOET_WALTxnCommand_Object uint16 = 3015 IOET_WALTxnCommand_Database_V1 uint16 = 1 IOET_WALTxnCommand_Table_V3 uint16 = 3 IOET_WALTxnCommand_Object_V1 uint16 = 1 IOET_WALTxnCommand_Database_CurrVer = IOET_WALTxnCommand_Database_V1 IOET_WALTxnCommand_Table_CurrVer = IOET_WALTxnCommand_Table_V3 IOET_WALTxnCommand_Object_CurrVer = IOET_WALTxnCommand_Object_V1 )
const ( PhyAddrColumnName = objectio.PhysicalAddr_Attr PhyAddrColumnComment = "Physical address" TenantSysID = uint32(0) )
const ( ModelSchemaName = "_ModelSchema" ModelAttrET = "ET" ModelAttrID = "ID" ModelAttrName = "NAME" ModelAttrTS = "TS" ModelAttrOpT = "OPT" ModelAttrLogIdx = "LOGIDX" ModelAttrInfo = "INFO" ModelAttrParentID = "PARENTID" )
const ( ObjectState_Create_Active uint8 = iota ObjectState_Create_PrepareCommit ObjectState_Create_ApplyCommit ObjectState_Delete_Active ObjectState_Delete_PrepareCommit ObjectState_Delete_ApplyCommit )
const (
AccessInfoSize int64 = int64(unsafe.Sizeof(accessInfo{}))
)
const (
Backup_Object_Offset uint16 = 1000
)
const (
EntryMVCCNodeSize int = int(unsafe.Sizeof(EntryMVCCNode{}))
)
Variables ¶
var (
AppendNodeApproxSize int
)
Functions ¶
func AddMergeTrace ¶
func AddMergeTrace(id uint64)
func CheckMergeTrace ¶
func CompareBaseNode ¶ added in v0.8.0
func EncodeAccessInfo ¶ added in v0.8.0
func EncodeAccessInfo(ai *accessInfo) []byte
func EncodeBlockNode ¶ added in v0.8.0
func EncodeEntryMVCCNode ¶ added in v0.8.0
func EncodeEntryMVCCNode(node *EntryMVCCNode) []byte
func GetAttrIdx ¶
func InputObjectZapFields ¶
func LevelDistToZapFields ¶
func LogInputDataObject ¶
func LogInputDataObject( table *TableEntry, stats *objectio.ObjectStats, createTime types.TS, )
func LogInputTombstoneObjectAsync ¶
func LogInputTombstoneObjectAsync( table *TableEntry, stats *objectio.ObjectStats, createTime types.TS, rt *dbutils.Runtime, )
func LogInputTombstoneObjectWithExistingBatches ¶
func LogInputTombstoneObjectWithExistingBatches( table *TableEntry, stats *objectio.ObjectStats, createTime types.TS, existingBatches []*batch.Batch, )
func MockTxnFactory ¶
func MockTxnFactory(catalog *Catalog) txnbase.TxnFactory
func MockTxnStoreFactory ¶
func MockTxnStoreFactory(catalog *Catalog) txnbase.TxnStoreFactory
func NewCNTombstoneBatchByPKType ¶
rowid, pk, commitTS used in Collect Delete in Range
func NewEmptyMVCCNodeFactory ¶ added in v0.8.0
func NewTombstoneBatchByPKType ¶
rowid, pk, commitTS used in Collect Delete in Range
func NewTombstoneBatchWithPKVector ¶
func NewTombstoneBatchWithPKVector(pkVec, rowIDVec containers.Vector, mp *mpool.MPool) *containers.Batch
rowid, pk used in range delete
func ObjectValid ¶
func ObjectValid(objectEntry *ObjectEntry) bool
func RemoveMergeTrace ¶
func RemoveMergeTrace(id uint64)
Types ¶
type BaseEntryImpl ¶ added in v0.8.0
type BaseEntryImpl[T BaseNode[T]] struct { //chain of MetadataMVCCNode txnbase.MVCCChain[*MVCCNode[T]] }
func NewBaseEntry ¶ added in v0.8.0
func NewBaseEntry[T BaseNode[T]](factory func() T) *BaseEntryImpl[T]
func (*BaseEntryImpl[T]) ConflictCheck ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) ConflictCheck(txn txnif.TxnReader) (err error)
func (*BaseEntryImpl[T]) CreateWithTSLocked ¶
func (be *BaseEntryImpl[T]) CreateWithTSLocked(ts types.TS, baseNode T)
func (*BaseEntryImpl[T]) CreateWithTxnLocked ¶
func (be *BaseEntryImpl[T]) CreateWithTxnLocked(txn txnif.AsyncTxn, baseNode T)
func (*BaseEntryImpl[T]) DeleteAfter ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) DeleteAfter(ts types.TS) bool
func (*BaseEntryImpl[T]) DeleteBefore ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) DeleteBefore(ts types.TS) bool
func (*BaseEntryImpl[T]) DeleteBeforeLocked ¶ added in v1.2.0
func (be *BaseEntryImpl[T]) DeleteBeforeLocked(ts types.TS) bool
func (*BaseEntryImpl[T]) DeleteLocked ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) DeleteLocked(txn txnif.TxnReader) (isNewNode bool, err error)
func (*BaseEntryImpl[T]) DropEntryLocked ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) DropEntryLocked(txn txnif.TxnReader) (isNewNode bool, err error)
func (*BaseEntryImpl[T]) GetCreatedAtLocked ¶ added in v1.0.0
func (be *BaseEntryImpl[T]) GetCreatedAtLocked() types.TS
func (*BaseEntryImpl[T]) GetDeleteAtLocked ¶ added in v1.2.0
func (be *BaseEntryImpl[T]) GetDeleteAtLocked() types.TS
func (*BaseEntryImpl[T]) GetVisibility ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) GetVisibility(txn txnif.TxnReader) (visible, dropped bool)
func (*BaseEntryImpl[T]) GetVisibilityLocked ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) GetVisibilityLocked(txn txnif.TxnReader) (visible, dropped bool)
func (*BaseEntryImpl[T]) HasDropCommitted ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) HasDropCommitted() bool
func (*BaseEntryImpl[T]) HasDropCommittedLocked ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) HasDropCommittedLocked() bool
func (*BaseEntryImpl[T]) IsVisibleWithLock ¶ added in v1.2.0
func (*BaseEntryImpl[T]) NeedWaitCommittingLocked ¶ added in v1.2.0
func (*BaseEntryImpl[T]) PPStringLocked ¶
func (*BaseEntryImpl[T]) PrepareAdd ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) PrepareAdd(txn txnif.TxnReader) (err error)
func (*BaseEntryImpl[T]) String ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) String() string
func (*BaseEntryImpl[T]) StringLocked ¶ added in v0.8.0
func (be *BaseEntryImpl[T]) StringLocked() string
type BlockNode ¶ added in v0.8.0
type BlockNode struct {
// contains filtered or unexported fields
}
func (*BlockNode) ApproxSize ¶
type Catalog ¶
type Catalog struct {
DataFactory
*IDAllocator
*sync.RWMutex
// contains filtered or unexported fields
}
func MockCatalog ¶
func MockCatalog(dataFactory DataFactory) *Catalog
func OpenCatalog ¶
func OpenCatalog(usageMemo any, dataFactory DataFactory) (*Catalog, error)
func (*Catalog) AddEntryLocked ¶
func (*Catalog) CheckMetadata ¶
func (catalog *Catalog) CheckMetadata()
func (*Catalog) CreateDBEntry ¶
func (*Catalog) CreateDBEntryWithID ¶ added in v0.6.0
func (*Catalog) DropDBEntry ¶
func (catalog *Catalog) DropDBEntry(entry *DBEntry, txn txnif.AsyncTxn) (isNewMVCCNode bool, err error)
DropDBEntry attach a drop mvvc node the entry.
func (*Catalog) DropDBEntryByID ¶ added in v0.6.0
func (*Catalog) DropDBEntryByName ¶ added in v1.2.0
func (*Catalog) GetDatabaseByID ¶
func (*Catalog) GetItemNodeByIDLocked ¶ added in v0.6.0
func (catalog *Catalog) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*DBEntry]
func (*Catalog) GetUsageMemo ¶ added in v1.1.0
func (*Catalog) InitSource ¶
func (catalog *Catalog) InitSource() iter.Seq[MergeTable]
func (*Catalog) InitSystemDB ¶
func (catalog *Catalog) InitSystemDB()
func (*Catalog) MakeDBIt ¶
func (catalog *Catalog) MakeDBIt(reverse bool) *common.GenericSortedDListIt[*DBEntry]
func (*Catalog) OnReplayObjectBatch ¶ added in v1.1.0
func (catalog *Catalog) OnReplayObjectBatch( replayer ObjectListReplayer, objectInfo *containers.Batch, isTombstone bool, forSys bool, )
func (*Catalog) OnReplayObjectBatch_V2 ¶
func (*Catalog) RelayFromSysTableObjects ¶
func (catalog *Catalog) RelayFromSysTableObjects( ctx context.Context, readTxn txnif.AsyncTxn, readFunc func(context.Context, *TableEntry, txnif.AsyncTxn) *containers.Batch, sortFunc func([]containers.Vector, int) error, replayer ObjectListReplayer, ) (closeCB []func())
func (*Catalog) RemoveDBEntry ¶ added in v1.2.0
RemoveDBEntry removes a database entry from the catalog physically, triggered by GC Task
func (*Catalog) ReplayCmd ¶
func (catalog *Catalog) ReplayCmd( txncmd txnif.TxnCmd, observer wal.ReplayObserver, )
func (*Catalog) ReplayMODatabase ¶
func (catalog *Catalog) ReplayMODatabase(ctx context.Context, txnNode *txnbase.TxnMVCCNode, bat *containers.Batch)
func (*Catalog) ReplayMOTables ¶
func (catalog *Catalog) ReplayMOTables(ctx context.Context, txnNode *txnbase.TxnMVCCNode, tblBat, colBat *containers.Batch, replayer ObjectListReplayer)
func (*Catalog) ReplayTableRows ¶
func (catalog *Catalog) ReplayTableRows()
func (*Catalog) SetMergeNotifier ¶
func (catalog *Catalog) SetMergeNotifier(notifier MergeNotifierOnCatalog)
func (*Catalog) SetUsageMemo ¶ added in v1.1.0
func (*Catalog) SimplePPString ¶
func (*Catalog) TxnGetDBEntryByID ¶ added in v0.6.0
type CatalogEventSource ¶
type CatalogEventSource interface {
InitSource() iter.Seq[MergeTable]
SetMergeNotifier(MergeNotifierOnCatalog)
GetMergeSettingsBatchFn() func() (*batch.Batch, func())
}
type ColDef ¶
type ColDef struct {
// letter case: origin
Name string
Idx int // indicates its position in all coldefs
SeqNum uint16 //
Type types.Type
Hidden bool // Hidden Column is generated by compute layer, keep hidden from user
PhyAddr bool // PhyAddr Column is generated by tae as rowid
NullAbility bool
AutoIncrement bool
Primary bool
SortIdx int8 // indicates its position in all sort keys
SortKey bool
Comment string
ClusterBy bool
FakePK bool // TODO: use column.flag instead of column.fakepk
Default []byte
OnUpdate []byte
GeneratedCol []byte
EnumValues string
}
func ColDefFromAttribute ¶ added in v0.7.0
make a basic coldef without sortKey info
func (*ColDef) ApproxSize ¶
func (*ColDef) IsAutoIncrement ¶ added in v0.6.0
func (*ColDef) IsClusterBy ¶ added in v0.7.0
func (*ColDef) IsCompositeColumn ¶
func (*ColDef) IsRealPrimary ¶ added in v0.8.0
type DBEntry ¶
type DBEntry struct {
ID uint64
*BaseEntryImpl[*EmptyMVCCNode]
*DBNode
// contains filtered or unexported fields
}
func MockDBEntryWithAccInfo ¶ added in v1.1.0
only for test
func NewDBEntryWithID ¶ added in v0.6.0
func NewReplayDBEntry ¶
func NewReplayDBEntry() *DBEntry
func NewSystemDBEntry ¶
func (*DBEntry) AddEntryLocked ¶
func (e *DBEntry) AddEntryLocked(table *TableEntry, txn txnif.TxnReader, skipDedup bool) (err error)
Catalog entry is created in following steps: 1. Locate the record. Creating always gets the latest DBEntry. 2.1 If there doesn't exist a DBEntry, add new entry and return. 2.2 If there exists a DBEntry: 2.2.1 Check conflication.
- Wait for the related txn if need.
- w-w conflict when: there's an active txn; or he CommitTS of the latest related txn is larger than StartTS of write txn
2.2.2 Check duplicate/not found. If the entry hasn't been dropped, return ErrDuplicate.
func (*DBEntry) AsCommonID ¶ added in v0.8.0
func (*DBEntry) CoarseTableCnt ¶
func (*DBEntry) CreateTableEntry ¶
func (e *DBEntry) CreateTableEntry(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory) (created *TableEntry, err error)
func (*DBEntry) CreateTableEntryWithTableId ¶ added in v0.6.0
func (e *DBEntry) CreateTableEntryWithTableId(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory, tableId uint64) (created *TableEntry, err error)
func (*DBEntry) DropTableEntry ¶
func (e *DBEntry) DropTableEntry(name string, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)
Catalog entry is dropped in following steps: 1. Locate the record by timestamp 2. Check conflication. 2.1 Wait for the related txn if need. 2.2 w-w conflict when 1. there's an active txn; or
- the CommitTS of the latest related txn is larger than StartTS of write txn
3. Check duplicate/not found. If the entry has already been dropped, return ErrNotFound.
func (*DBEntry) DropTableEntryByID ¶ added in v0.6.0
func (*DBEntry) GetCatalog ¶
func (*DBEntry) GetCreateAt ¶ added in v0.6.0
func (*DBEntry) GetCreateSql ¶ added in v0.6.0
func (*DBEntry) GetDatType ¶ added in v0.8.0
func (*DBEntry) GetFullName ¶ added in v0.6.0
func (*DBEntry) GetItemNodeByIDLocked ¶ added in v0.6.0
func (e *DBEntry) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*TableEntry]
func (*DBEntry) GetObjectEntryByID ¶ added in v1.2.0
func (*DBEntry) GetTableEntryByID ¶
func (e *DBEntry) GetTableEntryByID(id uint64) (table *TableEntry, err error)
func (*DBEntry) GetTableEntryByName ¶ added in v0.6.0
func (*DBEntry) GetTenantID ¶ added in v0.6.0
func (*DBEntry) IsSubscription ¶ added in v0.8.0
func (*DBEntry) IsSystemDB ¶
func (*DBEntry) MakeTableIt ¶
func (e *DBEntry) MakeTableIt(reverse bool) *common.GenericSortedDListIt[*TableEntry]
func (*DBEntry) PrepareRollback ¶
func (*DBEntry) PrettyNameIndex ¶ added in v0.8.0
For test only
func (*DBEntry) RemoveEntry ¶
func (e *DBEntry) RemoveEntry(table *TableEntry) (err error)
func (*DBEntry) RenameTableInTxn ¶ added in v0.8.0
func (*DBEntry) RollbackRenameTable ¶ added in v0.8.0
func (*DBEntry) StringLocked ¶
func (*DBEntry) StringWithLevel ¶ added in v0.6.0
func (*DBEntry) StringWithlevelLocked ¶ added in v0.6.0
func (*DBEntry) TxnGetTableEntryByID ¶ added in v0.6.0
func (*DBEntry) TxnGetTableEntryByName ¶ added in v0.6.0
type DBNode ¶ added in v0.8.0
type DBNode struct {
// contains filtered or unexported fields
}
func (*DBNode) ApproxSize ¶
func (*DBNode) TestSetAccId ¶ added in v1.1.1
only used in ut test
type DataFactory ¶
type DataFactory interface {
MakeTableFactory() TableDataFactory
MakeObjectFactory() ObjectDataFactory
}
type EmptyMVCCNode ¶ added in v0.8.0
type EmptyMVCCNode struct{}
func NewEmptyEmptyMVCCNode ¶ added in v0.8.0
func NewEmptyEmptyMVCCNode() *EmptyMVCCNode
func (*EmptyMVCCNode) ApproxSize ¶
func (e *EmptyMVCCNode) ApproxSize() int64
func (*EmptyMVCCNode) CloneAll ¶ added in v0.8.0
func (e *EmptyMVCCNode) CloneAll() *EmptyMVCCNode
func (*EmptyMVCCNode) CloneData ¶ added in v0.8.0
func (e *EmptyMVCCNode) CloneData() *EmptyMVCCNode
func (*EmptyMVCCNode) ReadFromWithVersion ¶ added in v1.0.0
func (*EmptyMVCCNode) String ¶ added in v0.8.0
func (e *EmptyMVCCNode) String() string
func (*EmptyMVCCNode) Update ¶ added in v0.8.0
func (e *EmptyMVCCNode) Update(vun *EmptyMVCCNode)
for create drop in one txn
type EntryCommand ¶
type EntryCommand[T BaseNode[T], N Node] struct { *txnbase.BaseCustomizedCmd ID *common.ID // contains filtered or unexported fields }
func (*EntryCommand[T, N]) ApplyCommit ¶ added in v0.6.0
func (cmd *EntryCommand[T, N]) ApplyCommit()
func (*EntryCommand[T, N]) ApplyRollback ¶ added in v0.6.0
func (cmd *EntryCommand[T, N]) ApplyRollback()
func (*EntryCommand[T, N]) ApproxSize ¶
func (cmd *EntryCommand[T, N]) ApproxSize() int64
func (*EntryCommand[T, N]) Desc ¶
func (cmd *EntryCommand[T, N]) Desc() string
func (*EntryCommand[T, N]) GetCurrVersion ¶ added in v0.8.0
func (cmd *EntryCommand[T, N]) GetCurrVersion() uint16
func (*EntryCommand[T, N]) GetID ¶
func (cmd *EntryCommand[T, N]) GetID() *common.ID
func (*EntryCommand[T, N]) GetMVCCNode ¶
func (cmd *EntryCommand[T, N]) GetMVCCNode() *MVCCNode[T]
func (*EntryCommand[T, N]) GetTs ¶
func (cmd *EntryCommand[T, N]) GetTs() types.TS
func (*EntryCommand[T, N]) GetType ¶
func (cmd *EntryCommand[T, N]) GetType() uint16
func (*EntryCommand[T, N]) IDString ¶
func (cmd *EntryCommand[T, N]) IDString() string
func (*EntryCommand[T, N]) MarshalBinary ¶ added in v0.8.0
func (cmd *EntryCommand[T, N]) MarshalBinary() (buf []byte, err error)
func (*EntryCommand[T, N]) MarshalBinaryWithBuffer ¶
func (cmd *EntryCommand[T, N]) MarshalBinaryWithBuffer(buf *bytes.Buffer) error
func (*EntryCommand[T, N]) ReadFrom ¶
func (cmd *EntryCommand[T, N]) ReadFrom(r io.Reader) (n int64, err error)
func (*EntryCommand[T, N]) SetReplayTxn ¶ added in v0.6.0
func (cmd *EntryCommand[T, N]) SetReplayTxn(txn txnif.AsyncTxn)
func (*EntryCommand[T, N]) String ¶
func (cmd *EntryCommand[T, N]) String() string
func (*EntryCommand[T, N]) UnmarshalBinary ¶ added in v0.8.0
func (cmd *EntryCommand[T, N]) UnmarshalBinary(buf []byte) (err error)
func (*EntryCommand[T, N]) VerboseString ¶
func (cmd *EntryCommand[T, N]) VerboseString() string
type EntryMVCCNode ¶ added in v0.6.0
func DecodeEntryMVCCNode ¶ added in v0.8.0
func DecodeEntryMVCCNode(v []byte) *EntryMVCCNode
func ReadEntryNodeTuple ¶ added in v1.1.0
func ReadEntryNodeTuple(createAt, deleteAt types.TS) (un *EntryMVCCNode)
func (EntryMVCCNode) AppendObjectTuple ¶
func (un EntryMVCCNode) AppendObjectTuple(bat *containers.Batch, create bool)
func (EntryMVCCNode) AppendTupleWithCommitTS ¶ added in v1.1.0
func (un EntryMVCCNode) AppendTupleWithCommitTS(bat *containers.Batch, ts types.TS)
func (*EntryMVCCNode) ApplyCommit ¶ added in v0.6.0
func (un *EntryMVCCNode) ApplyCommit(ts types.TS) (err error)
func (EntryMVCCNode) Clone ¶ added in v0.6.0
func (un EntryMVCCNode) Clone() EntryMVCCNode
func (*EntryMVCCNode) Delete ¶ added in v0.6.0
func (un *EntryMVCCNode) Delete()
func (EntryMVCCNode) GetCreatedAt ¶ added in v0.6.0
func (un EntryMVCCNode) GetCreatedAt() types.TS
func (EntryMVCCNode) GetDeletedAt ¶ added in v0.6.0
func (un EntryMVCCNode) GetDeletedAt() types.TS
func (EntryMVCCNode) HasDropCommitted ¶ added in v0.6.0
func (un EntryMVCCNode) HasDropCommitted() bool
Dropped committed
func (EntryMVCCNode) HasDropIntent ¶ added in v0.6.0
func (un EntryMVCCNode) HasDropIntent() bool
Dropped committed or uncommitted
func (EntryMVCCNode) IsCreating ¶ added in v0.6.0
func (un EntryMVCCNode) IsCreating() bool
func (EntryMVCCNode) PrepareCommit ¶ added in v0.6.0
func (un EntryMVCCNode) PrepareCommit() (err error)
func (*EntryMVCCNode) ReadFrom ¶ added in v0.6.0
func (un *EntryMVCCNode) ReadFrom(r io.Reader) (n int64, err error)
func (EntryMVCCNode) String ¶ added in v0.6.0
func (un EntryMVCCNode) String() string
type EntryState ¶
type EntryState int8
const ( ES_Appendable EntryState = iota ES_NotAppendable ES_Frozen )
func (EntryState) Repr ¶
func (es EntryState) Repr() string
type IDAllocator ¶
type IDAllocator struct {
// contains filtered or unexported fields
}
func NewIDAllocator ¶
func NewIDAllocator() *IDAllocator
func (*IDAllocator) CurrBlock ¶
func (alloc *IDAllocator) CurrBlock() uint64
func (*IDAllocator) CurrDB ¶
func (alloc *IDAllocator) CurrDB() uint64
func (*IDAllocator) CurrObject ¶
func (alloc *IDAllocator) CurrObject() uint64
func (*IDAllocator) CurrTable ¶
func (alloc *IDAllocator) CurrTable() uint64
func (*IDAllocator) IDStates ¶
func (alloc *IDAllocator) IDStates() string
func (*IDAllocator) Init ¶
func (alloc *IDAllocator) Init(prevDb, prevTbl, prevObj, prevBlk uint64)
func (*IDAllocator) NextBlock ¶
func (alloc *IDAllocator) NextBlock() uint64
func (*IDAllocator) NextDB ¶
func (alloc *IDAllocator) NextDB() uint64
func (*IDAllocator) NextObject ¶
func (alloc *IDAllocator) NextObject() uint64
func (*IDAllocator) NextTable ¶
func (alloc *IDAllocator) NextTable() uint64
func (*IDAllocator) OnReplayBlockID ¶
func (alloc *IDAllocator) OnReplayBlockID(id uint64)
func (*IDAllocator) OnReplayDBID ¶
func (alloc *IDAllocator) OnReplayDBID(id uint64)
func (*IDAllocator) OnReplayObjectID ¶
func (alloc *IDAllocator) OnReplayObjectID(id uint64)
func (*IDAllocator) OnReplayTableID ¶
func (alloc *IDAllocator) OnReplayTableID(id uint64)
type LevelDist ¶
type LevelDist struct {
Lv int
ObjCnt int // hitted object count
ObjCntProportion float64 // hitted object count / total object count
DelAvg float64 // average deleted row proportion of hitted objects
DelVar float64 // variance of deleted row proportion of hitted objects
}
func CalcTombstoneDist ¶
func CalcTombstoneDist( table *TableEntry, rowids map[objectio.ObjectId]int, ) []LevelDist
type LoopProcessor ¶
type LoopProcessor struct {
DatabaseFn func(*DBEntry) error
TableFn func(*TableEntry) error
ObjectFn func(*ObjectEntry) error
PostDatabaseFn func(*DBEntry) error
PostTableFn func(*TableEntry) error
PostObjectFn func(*ObjectEntry) error
TombstoneFn func(*ObjectEntry) error
}
func (*LoopProcessor) OnDatabase ¶
func (p *LoopProcessor) OnDatabase(database *DBEntry) error
func (*LoopProcessor) OnObject ¶ added in v1.1.0
func (p *LoopProcessor) OnObject(Object *ObjectEntry) error
func (*LoopProcessor) OnPostDatabase ¶ added in v1.0.0
func (p *LoopProcessor) OnPostDatabase(database *DBEntry) error
func (*LoopProcessor) OnPostObject ¶ added in v1.1.0
func (p *LoopProcessor) OnPostObject(Object *ObjectEntry) error
func (*LoopProcessor) OnPostTable ¶ added in v1.0.0
func (p *LoopProcessor) OnPostTable(table *TableEntry) error
func (*LoopProcessor) OnTable ¶
func (p *LoopProcessor) OnTable(table *TableEntry) error
func (*LoopProcessor) OnTombstone ¶ added in v1.2.0
func (p *LoopProcessor) OnTombstone(tombstone *ObjectEntry) error
type MVCCNode ¶ added in v0.8.0
type MVCCNode[T BaseNode[T]] struct { EntryMVCCNode txnbase.TxnMVCCNode BaseNode T CommitSideEffect func(id string, commitTs types.TS) // used for object replay, no need to persist }
func (*MVCCNode[T]) ApplyCommit ¶ added in v0.8.0
func (*MVCCNode[T]) ApplyRollback ¶ added in v0.8.0
func (*MVCCNode[T]) ApproxSize ¶
func (*MVCCNode[T]) PrepareCommit ¶ added in v0.8.0
func (*MVCCNode[T]) PrepareRollback ¶ added in v0.8.0
func (*MVCCNode[T]) ReadFromWithVersion ¶ added in v1.0.0
type MergeDataItem ¶
type MergeDataItem interface {
GetCreatedAt() types.TS
GetObjectStats() *objectio.ObjectStats
}
type MergeNotifierOnCatalog ¶
type MergeNotifierOnCatalog interface {
// OnCreateTableCommit is called when a table is created and committed.
// The table is not visible to users until it is committed.
OnCreateTableCommit(table MergeTable)
// OnCreateNonAppendObject is called when a non-appendable object is created, committed is not required
// CreateNonAppendObject is just used for trigger merge task, it is not a big deal if the object is rollbacked
OnCreateNonAppendObject(table MergeTable)
}
type MergeTable ¶
type MergeTable interface {
IterDataItem() iter.Seq[MergeDataItem]
IterTombstoneItem() iter.Seq[MergeTombstoneItem]
GetNameDesc() string
ID() uint64
HasDropCommitted() bool
IsSpecialBigTable() bool // upgrade: old objects in big table is not merged by default
IsFromPublication() bool // check if table is created by publication, should skip merge
}
func ToMergeTable ¶
func ToMergeTable(tbl *TableEntry) MergeTable
type MergeTombstoneItem ¶
type MergeTombstoneItem interface {
MergeDataItem
// IO
ForeachRowid(
ctx context.Context,
reuseBatch any,
each func(rowid types.Rowid, isNull bool, rowIdx int) error,
) error
// make a buffer batch for IO, reuse for every tombstone item
// the second return value is the cleanup function
MakeBufferBatch() (any, func())
}
type MetadataMVCCNode ¶ added in v0.6.0
type MetadataMVCCNode struct {
MetaLoc objectio.Location
DeltaLoc objectio.Location
// For deltaloc from CN, it needs to ensure that deleteChain is empty.
NeedCheckDeleteChainWhenCommit bool
}
func NewEmptyMetadataMVCCNode ¶ added in v0.6.0
func NewEmptyMetadataMVCCNode() *MetadataMVCCNode
func (*MetadataMVCCNode) ApproxSize ¶
func (e *MetadataMVCCNode) ApproxSize() int64
func (*MetadataMVCCNode) CloneAll ¶ added in v0.6.0
func (e *MetadataMVCCNode) CloneAll() *MetadataMVCCNode
func (*MetadataMVCCNode) CloneData ¶ added in v0.6.0
func (e *MetadataMVCCNode) CloneData() *MetadataMVCCNode
func (*MetadataMVCCNode) ReadFromWithVersion ¶ added in v1.0.0
func (*MetadataMVCCNode) String ¶ added in v0.6.0
func (e *MetadataMVCCNode) String() string
func (*MetadataMVCCNode) Update ¶ added in v0.6.0
func (e *MetadataMVCCNode) Update(un *MetadataMVCCNode)
for create drop in one txn
type ObjectDataFactory ¶ added in v1.2.0
type ObjectDataFactory = func(meta *ObjectEntry) data.Object
type ObjectEntry ¶ added in v1.1.0
type ObjectEntry struct {
EntryMVCCNode // CreatedAt, DeletedAt
ObjectMVCCNode // ObjectStats
CreateNode txnbase.TxnMVCCNode
DeleteNode txnbase.TxnMVCCNode
ObjectState uint8
ObjectNode // auxiliary info
HasPrintedPrepareComapct atomic.Bool
// contains filtered or unexported fields
}
func IsTableTailFlushed ¶
func IsTableTailFlushed(table *TableEntry, start, end types.TS, isTombstone bool) (bool, *ObjectEntry)
func MockCreatedObjectEntry2List ¶
func MockCreatedObjectEntry2List( rel *TableEntry, catalog *Catalog, isTombstone bool, create types.TS) *ObjectEntry
func MockDroppedObjectEntry2List ¶
func MockDroppedObjectEntry2List(created *ObjectEntry, delete types.TS) *ObjectEntry
func MockObjEntryWithTbl ¶ added in v1.1.0
func MockObjEntryWithTbl(tbl *TableEntry, size uint64, isTombstone bool) *ObjectEntry
func MockObjectEntry ¶
func MockObjectEntry( tbl *TableEntry, stats *objectio.ObjectStats, isTombstone bool, dataFactory ObjectDataFactory, ts types.TS, ) *ObjectEntry
func NewObjectEntry ¶ added in v1.1.0
func NewObjectEntry( table *TableEntry, txn txnif.AsyncTxn, stats objectio.ObjectStats, dataFactory ObjectDataFactory, isTombstone bool, ) *ObjectEntry
func NewReplayObjectEntry ¶ added in v1.1.0
func NewReplayObjectEntry() *ObjectEntry
func NewStandaloneObject ¶ added in v1.1.0
func NewStandaloneObject(table *TableEntry, ts types.TS, isTombstone bool) *ObjectEntry
func (*ObjectEntry) ApplyCommit ¶
func (entry *ObjectEntry) ApplyCommit(tid string) error
func (*ObjectEntry) ApplyRollback ¶
func (entry *ObjectEntry) ApplyRollback() error
func (*ObjectEntry) AsCommonID ¶ added in v1.1.0
func (entry *ObjectEntry) AsCommonID() *common.ID
func (*ObjectEntry) BlockCnt ¶ added in v1.1.0
func (entry *ObjectEntry) BlockCnt() int
func (*ObjectEntry) CheckPrintPrepareCompact ¶ added in v1.2.1
func (entry *ObjectEntry) CheckPrintPrepareCompact() bool
TODO: REMOVEME
func (*ObjectEntry) CheckPrintPrepareCompactLocked ¶ added in v1.2.1
func (entry *ObjectEntry) CheckPrintPrepareCompactLocked(duration time.Duration) bool
func (*ObjectEntry) Clone ¶
func (entry *ObjectEntry) Clone() *ObjectEntry
func (*ObjectEntry) DeleteBefore ¶
func (entry *ObjectEntry) DeleteBefore(ts types.TS) bool
func (*ObjectEntry) ForeachMVCCNodeInRange ¶
func (entry *ObjectEntry) ForeachMVCCNodeInRange(start, end types.TS, f func(*txnbase.TxnMVCCNode) error) error
func (*ObjectEntry) GetCommandMVCCNode ¶
func (entry *ObjectEntry) GetCommandMVCCNode() *MVCCNode[*ObjectMVCCNode]
func (*ObjectEntry) GetCreatedAt ¶
func (entry *ObjectEntry) GetCreatedAt() types.TS
func (*ObjectEntry) GetDeleteAt ¶
func (entry *ObjectEntry) GetDeleteAt() types.TS
func (*ObjectEntry) GetDropEntry ¶
func (entry *ObjectEntry) GetDropEntry( txn txnif.TxnReader, ) (dropped *ObjectEntry, updatedCEntry *ObjectEntry, isNewNode bool)
func (*ObjectEntry) GetLastMVCCNode ¶
func (entry *ObjectEntry) GetLastMVCCNode() *txnbase.TxnMVCCNode
func (*ObjectEntry) GetLatestCommittedNode ¶
func (entry *ObjectEntry) GetLatestCommittedNode() *txnbase.TxnMVCCNode
func (*ObjectEntry) GetLatestNode ¶
func (entry *ObjectEntry) GetLatestNode() *ObjectEntry
func (*ObjectEntry) GetLoaded ¶ added in v1.1.0
func (entry *ObjectEntry) GetLoaded() bool
func (*ObjectEntry) GetLocation ¶ added in v1.2.0
func (entry *ObjectEntry) GetLocation() objectio.Location
func (*ObjectEntry) GetNextVersion ¶
func (entry *ObjectEntry) GetNextVersion() *ObjectEntry
func (*ObjectEntry) GetNonAppendableBlockCnt ¶ added in v1.1.0
func (entry *ObjectEntry) GetNonAppendableBlockCnt() int
GetNonAppendableBlockCnt Non-appendable Object only can contain non-appendable blocks; Appendable Object can contain both of appendable blocks and non-appendable blocks
func (*ObjectEntry) GetObjectData ¶ added in v1.2.0
func (entry *ObjectEntry) GetObjectData() data.Object
func (*ObjectEntry) GetObjectStats ¶ added in v1.1.0
func (entry *ObjectEntry) GetObjectStats() (stats *objectio.ObjectStats)
func (*ObjectEntry) GetPrevVersion ¶
func (entry *ObjectEntry) GetPrevVersion() *ObjectEntry
func (*ObjectEntry) GetSchema ¶ added in v1.2.0
func (entry *ObjectEntry) GetSchema() *Schema
func (*ObjectEntry) GetTable ¶ added in v1.1.0
func (entry *ObjectEntry) GetTable() *TableEntry
func (*ObjectEntry) GetUpdateEntry ¶
func (entry *ObjectEntry) GetUpdateEntry( txn txnif.TxnReader, stats *objectio.ObjectStats, ) ( dropped *ObjectEntry, updatedCEntry *ObjectEntry, isNewNode bool, )
func (*ObjectEntry) HasCommittedPersistedData ¶ added in v1.2.0
func (entry *ObjectEntry) HasCommittedPersistedData() bool
PXU TODO: I can't understand this code aobj has persisted data after it is dropped obj always has persisted data
func (*ObjectEntry) HasDCounterpart ¶
func (entry *ObjectEntry) HasDCounterpart() bool
func (*ObjectEntry) HasDropCommitted ¶
func (entry *ObjectEntry) HasDropCommitted() bool
func (*ObjectEntry) HasDropIntent ¶
func (entry *ObjectEntry) HasDropIntent() bool
func (*ObjectEntry) HasPersistedData ¶ added in v1.2.0
func (entry *ObjectEntry) HasPersistedData() bool
func (*ObjectEntry) ID ¶ added in v1.1.0
func (entry *ObjectEntry) ID() *objectio.ObjectId
func (*ObjectEntry) InitData ¶ added in v1.2.0
func (entry *ObjectEntry) InitData(factory DataFactory)
func (*ObjectEntry) IsActive ¶ added in v1.1.0
func (entry *ObjectEntry) IsActive() bool
IsActive is coarse API: no consistency check
func (*ObjectEntry) IsAppendable ¶ added in v1.1.0
func (entry *ObjectEntry) IsAppendable() bool
func (*ObjectEntry) IsCEntry ¶
func (entry *ObjectEntry) IsCEntry() bool
func (*ObjectEntry) IsCommitted ¶
func (entry *ObjectEntry) IsCommitted() bool
func (*ObjectEntry) IsCreatingOrAborted ¶
func (entry *ObjectEntry) IsCreatingOrAborted() bool
func (*ObjectEntry) IsDEntry ¶
func (entry *ObjectEntry) IsDEntry() bool
func (*ObjectEntry) IsForcePNode ¶
func (entry *ObjectEntry) IsForcePNode() bool
func (*ObjectEntry) IsSorted ¶ added in v1.1.0
func (entry *ObjectEntry) IsSorted() bool
func (*ObjectEntry) Less ¶ added in v1.1.0
func (entry *ObjectEntry) Less(b *ObjectEntry) bool
func (*ObjectEntry) MakeCommand ¶ added in v1.1.0
func (entry *ObjectEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)
func (*ObjectEntry) ObjectPersisted ¶ added in v1.2.0
func (entry *ObjectEntry) ObjectPersisted() bool
for old flushed objects, stats may be empty
func (*ObjectEntry) PrepareCommit ¶
func (entry *ObjectEntry) PrepareCommit() error
func (*ObjectEntry) PrepareCompact ¶ added in v1.2.0
func (entry *ObjectEntry) PrepareCompact() bool
PrepareCompact is performance insensitive a block can be compacted: 1. no uncommited node 2. at least one committed node Note: Soft deleted nobjects might have in memory deletes to be flushed.
func (*ObjectEntry) PrepareCompactLocked ¶ added in v1.2.0
func (entry *ObjectEntry) PrepareCompactLocked() bool
func (*ObjectEntry) PrepareRollback ¶ added in v1.1.0
func (entry *ObjectEntry) PrepareRollback() (err error)
func (*ObjectEntry) PrintPrepareCompactDebugLog ¶ added in v1.2.1
func (entry *ObjectEntry) PrintPrepareCompactDebugLog()
TODO: REMOVEME
func (*ObjectEntry) Repr ¶ added in v1.1.0
func (entry *ObjectEntry) Repr() string
func (*ObjectEntry) StatsString ¶ added in v1.1.0
func (entry *ObjectEntry) StatsString(zonemapKind common.ZonemapPrintKind) string
func (*ObjectEntry) String ¶ added in v1.1.0
func (entry *ObjectEntry) String() string
func (*ObjectEntry) StringWithLevel ¶ added in v1.1.0
func (entry *ObjectEntry) StringWithLevel(level common.PPLevel) string
func (*ObjectEntry) TreeMaxDropCommitEntry ¶ added in v1.1.0
func (entry *ObjectEntry) TreeMaxDropCommitEntry() (BaseEntry, *ObjectEntry)
func (*ObjectEntry) UpdateObjectInfo ¶ added in v1.1.0
func (entry *ObjectEntry) UpdateObjectInfo(txn txnif.TxnReader, stats *objectio.ObjectStats) (isNewNode bool, err error)
func (*ObjectEntry) VisibleByTS ¶
func (entry *ObjectEntry) VisibleByTS(ts types.TS) bool
type ObjectList ¶
func NewObjectList ¶
func NewObjectList(isTombstone bool) *ObjectList
func (*ObjectList) DeleteAllEntries ¶
func (l *ObjectList) DeleteAllEntries(id *objectio.ObjectId) error
deleteEntryLocked deletes all entries with the given objectID, used in GC & Rollback
func (*ObjectList) DropObjectByID ¶
func (l *ObjectList) DropObjectByID( objectID *objectio.ObjectId, txn txnif.TxnReader, ) ( droppedObj *ObjectEntry, isNew bool, err error, )
DropObjectByID appends a delete node as a marker, used in SoftDeleteObject
func (*ObjectList) GetAllNodes ¶
func (l *ObjectList) GetAllNodes(id *objectio.ObjectId) []*ObjectEntry
func (*ObjectList) GetLastestNode ¶
func (l *ObjectList) GetLastestNode(id *objectio.ObjectId) *ObjectEntry
func (*ObjectList) GetObjectByID ¶
func (l *ObjectList) GetObjectByID(objectID *objectio.ObjectId) (obj *ObjectEntry, err error)
func (*ObjectList) MakeVisibleCommittedObjectIt ¶
func (l *ObjectList) MakeVisibleCommittedObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
func (*ObjectList) Set ¶
func (l *ObjectList) Set(object *ObjectEntry)
Set inserts a brand the objectstate, used in CreateObject
func (*ObjectList) Show ¶
func (l *ObjectList) Show() string
Show returns a string representation of the objectlist
func (*ObjectList) UpdateObjectInfo ¶
func (l *ObjectList) UpdateObjectInfo( obj *ObjectEntry, txn txnif.TxnReader, stats *objectio.ObjectStats, ) (isNew bool, err error)
UpdateObjectInfo must be called after DropObjectByID in a txn refer to flushTableTail
func (*ObjectList) UpdateReplayTs ¶
func (l *ObjectList) UpdateReplayTs(id *objectio.ObjectId, ts types.TS)
func (*ObjectList) WaitUntilCommitted ¶
func (l *ObjectList) WaitUntilCommitted(ts types.TS)
WaitUntilCommitted waits for entries in txn active zone with prepareTS > ts to move to committed zone. As CreateObject will be called in txn queue, when WaitUntilCommitted returns, all creating objects in txn active zone are invisible to ts, because they are created after ts.
type ObjectListReplayer ¶
type ObjectListReplayer interface {
Submit(uint64, func())
}
type ObjectMVCCNode ¶ added in v1.1.0
type ObjectMVCCNode struct {
objectio.ObjectStats
}
func NewEmptyObjectMVCCNode ¶ added in v1.1.0
func NewEmptyObjectMVCCNode() *ObjectMVCCNode
func NewObjectInfoWithMetaLocation ¶ added in v1.1.0
func NewObjectInfoWithMetaLocation(metaLoc objectio.Location, id *objectio.ObjectId) *ObjectMVCCNode
func NewObjectInfoWithObjectID ¶ added in v1.1.0
func NewObjectInfoWithObjectID(id *objectio.ObjectId) *ObjectMVCCNode
func NewObjectInfoWithObjectStats ¶ added in v1.1.0
func NewObjectInfoWithObjectStats(stats *objectio.ObjectStats) *ObjectMVCCNode
func ReadObjectInfoTuple ¶ added in v1.1.0
func ReadObjectInfoTuple(objs *vector.Vector, row int) (e *ObjectMVCCNode)
func (*ObjectMVCCNode) AppendTuple ¶ added in v1.1.0
func (e *ObjectMVCCNode) AppendTuple(sid *types.Objectid, batch *containers.Batch)
func (*ObjectMVCCNode) ApproxSize ¶
func (e *ObjectMVCCNode) ApproxSize() int64
func (*ObjectMVCCNode) CloneAll ¶ added in v1.1.0
func (e *ObjectMVCCNode) CloneAll() *ObjectMVCCNode
func (*ObjectMVCCNode) CloneData ¶ added in v1.1.0
func (e *ObjectMVCCNode) CloneData() *ObjectMVCCNode
func (*ObjectMVCCNode) IsEmpty ¶ added in v1.1.0
func (e *ObjectMVCCNode) IsEmpty() bool
func (*ObjectMVCCNode) ReadFromWithVersion ¶ added in v1.1.0
func (*ObjectMVCCNode) String ¶ added in v1.1.0
func (e *ObjectMVCCNode) String() string
func (*ObjectMVCCNode) Update ¶ added in v1.1.0
func (e *ObjectMVCCNode) Update(vun *ObjectMVCCNode)
type ObjectNode ¶ added in v1.1.0
type ObjectNode struct {
IsLocal bool // this object is hold by a localobject
SortHint uint64 // sort object by create time, make iteration on object determined
// for tombstone
IsTombstone bool
// contains filtered or unexported fields
}
func (*ObjectNode) ApproxSize ¶
func (node *ObjectNode) ApproxSize() int64
type Processor ¶
type Processor interface {
OnDatabase(database *DBEntry) error
OnPostDatabase(database *DBEntry) error
OnTable(table *TableEntry) error
OnPostTable(table *TableEntry) error
OnPostObject(object *ObjectEntry) error
OnObject(object *ObjectEntry) error
OnTombstone(tombstone *ObjectEntry) error
}
XXX this API is broken. In case of inplementing a cursor like interface we cannot use error. moerr is a very heavy mechanism.
Return a int code.
type Schema ¶
type Schema struct {
Version uint32
CatalogVersion uint32
AcInfo accessInfo
Name string
ColDefs []*ColDef
Comment string
Partitioned int8 // 1: the table has partitions ; 0: no partition
Partition string // the info about partitions when the table has partitions
Relkind string
Createsql string
View string
Constraint []byte
// do not send to cn
DeprecatedBlockMaxRows uint32
// for aobj, there're at most one blk
DeprecatedObjectMaxBlocks uint16
Extra *apipb.SchemaExtra
// do not write down, reconstruct them when reading
NameMap map[string]int // name(letter case: origin) -> logical idx
SeqnumMap map[uint16]int // seqnum -> logical idx
SortKey *SortKey
PhyAddrKey *ColDef
FromPublication bool // mark if table is created by publication, should skip merge
// contains filtered or unexported fields
}
var SystemColumnSchema *Schema
var SystemDBSchema *Schema
var SystemIndexTableSchema *Schema
var SystemTableSchema *Schema
func DefsToSchema ¶
func GetTombstoneSchema ¶
func MockSchema ¶
func MockSchemaAll ¶
MockSchemaAll if char/varchar is needed, colCnt = 14, otherwise colCnt = 12 pkIdx == -1 means no pk defined
func MockSchemaEnhanced ¶
`colCnt` specifies the number of columns in the schema. `pkIdx` specifies the index of the primary in the specified columns. `from` specifies the starting index of the columns in the predefined order.
func MockSnapShotSchema ¶ added in v1.2.0
func MockSnapShotSchema() *Schema
func NewEmptySchema ¶
func (*Schema) AllSeqnums ¶ added in v0.8.0
func (*Schema) AppendColDef ¶
func (*Schema) AppendColWithAttribute ¶ added in v0.6.0
func (*Schema) AppendFakePKCol ¶ added in v0.8.0
func (*Schema) AppendPKCol ¶
func (*Schema) AppendSortColWithAttribute ¶ added in v0.7.0
func (s *Schema) AppendSortColWithAttribute(attr engine.Attribute, sorIdx int, isPrimary bool) error
non-cn doesn't set IsPrimary in attr, so isPrimary is used explicitly here
func (*Schema) AppendSortKey ¶
func (*Schema) ApplyAlterTable ¶ added in v0.8.0
func (s *Schema) ApplyAlterTable(req *apipb.AlterTableReq) error
ApplyAlterTable modify the schema in place. Unless you know what you are doing, it is recommended to close schema first and then apply alter table.
func (*Schema) ApproxSize ¶
func (*Schema) EstimateRowSize ¶ added in v1.0.0
func (*Schema) Finalize ¶
Finalize runs various checks and create shortcuts to phyaddr and sortkey Note: NameMap is already set before calling Finalize
func (*Schema) GetColIdx ¶
GetColIdx returns column index for the given column name if found, otherwise returns -1.
func (*Schema) GetPrimaryKey ¶ added in v0.8.0
GetPrimaryKey gets the primary key, including fake primary key.
func (*Schema) GetSingleSortKey ¶
GetSingleSortKey should be call only if IsSinglePK is checked
func (*Schema) GetSingleSortKeyIdx ¶
func (*Schema) GetSingleSortKeyType ¶ added in v0.7.0
func (*Schema) HasPKOrFakePK ¶
func (*Schema) HasSortKey ¶
func (*Schema) IsSameColumns ¶ added in v0.8.0
func (*Schema) IsSecondaryIndexTable ¶ added in v1.2.0
func (*Schema) MustGetExtraBytes ¶ added in v0.8.0
func (*Schema) MustRestoreExtra ¶ added in v0.8.0
func (*Schema) ReadFromBatch ¶ added in v0.6.0
func (*Schema) ReadFromWithVersion ¶ added in v1.0.0
type SortKey ¶
type SortKey struct {
Defs []*ColDef
// contains filtered or unexported fields
}
func NewSortKey ¶
func NewSortKey() *SortKey
func (*SortKey) GetSingleIdx ¶
type TNMergeTable ¶
type TNMergeTable struct {
*TableEntry
}
func (TNMergeTable) ID ¶
func (t TNMergeTable) ID() uint64
func (TNMergeTable) IsFromPublication ¶
func (t TNMergeTable) IsFromPublication() bool
IsFromPublication checks if the table is created by publication This flag is set when parsing properties in DefsToSchema It also recursively checks parent tables (for index tables and partition tables)
func (TNMergeTable) IsSpecialBigTable ¶
func (t TNMergeTable) IsSpecialBigTable() bool
func (TNMergeTable) IterDataItem ¶
func (t TNMergeTable) IterDataItem() iter.Seq[MergeDataItem]
func (TNMergeTable) IterTombstoneItem ¶
func (t TNMergeTable) IterTombstoneItem() iter.Seq[MergeTombstoneItem]
type TNTombstoneItem ¶
type TNTombstoneItem struct {
*ObjectEntry
}
func (TNTombstoneItem) ForeachRowid ¶
func (TNTombstoneItem) MakeBufferBatch ¶
func (t TNTombstoneItem) MakeBufferBatch() (any, func())
type TableDataFactory ¶
type TableDataFactory = func(meta *TableEntry) data.Table
type TableEntry ¶
type TableEntry struct {
*BaseEntryImpl[*TableMVCCNode]
*TableNode
Stats common.TableCompactStat
ID uint64
// contains filtered or unexported fields
}
func MockStaloneTableEntry ¶
func MockStaloneTableEntry(id uint64, schema *Schema) *TableEntry
func MockTableEntryWithDB ¶ added in v1.1.0
func MockTableEntryWithDB(dbEntry *DBEntry, tblId uint64) *TableEntry
only for test
func NewReplayTableEntry ¶
func NewReplayTableEntry() *TableEntry
func NewSystemTableEntry ¶
func NewSystemTableEntry(db *DBEntry, id uint64, schema *Schema) *TableEntry
func NewTableEntry ¶
func NewTableEntry(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, dataFactory TableDataFactory) *TableEntry
func NewTableEntryWithTableId ¶ added in v0.6.0
func NewTableEntryWithTableId(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, dataFactory TableDataFactory, tableId uint64) *TableEntry
func (*TableEntry) AddEntryLocked ¶
func (entry *TableEntry) AddEntryLocked(objectEntry *ObjectEntry)
func (*TableEntry) AddRows ¶
func (entry *TableEntry) AddRows(delta uint64) uint64
func (*TableEntry) AlterTable ¶ added in v0.8.0
func (entry *TableEntry) AlterTable(ctx context.Context, txn txnif.TxnReader, req *apipb.AlterTableReq) (isNewNode bool, newSchema *Schema, err error)
func (*TableEntry) ApplyCommit ¶ added in v0.8.0
func (entry *TableEntry) ApplyCommit(id string) (err error)
s: start p: prepare c: commit
old schema <- | -> new schema
|
s------------------p-----c AlterColumn Txn
Append Txn:
s------------p----c Yes
s-------------p--------c Yes
s-----------------------p---------c Yes
s----------------------p No, schema at s is not same with schema at p
func (*TableEntry) AsCommonID ¶
func (entry *TableEntry) AsCommonID() *common.ID
func (*TableEntry) CreateObject ¶ added in v1.1.0
func (entry *TableEntry) CreateObject( txn txnif.AsyncTxn, opts *objectio.CreateObjOpt, dataFactory ObjectDataFactory, ) (created *ObjectEntry, err error)
func (*TableEntry) CreateWithTxnAndSchema ¶ added in v0.8.0
func (entry *TableEntry) CreateWithTxnAndSchema(txn txnif.AsyncTxn, schema *Schema)
func (*TableEntry) DropObjectEntry ¶ added in v1.1.0
func (entry *TableEntry) DropObjectEntry(id *types.Objectid, txn txnif.AsyncTxn, isTombstone bool) (deleted *ObjectEntry, err error)
func (*TableEntry) FreezeAppend ¶ added in v0.8.0
func (entry *TableEntry) FreezeAppend()
func (*TableEntry) GetCatalog ¶
func (entry *TableEntry) GetCatalog() *Catalog
func (*TableEntry) GetColDefs ¶ added in v0.6.0
func (entry *TableEntry) GetColDefs() []*ColDef
func (*TableEntry) GetDB ¶
func (entry *TableEntry) GetDB() *DBEntry
func (*TableEntry) GetFullName ¶ added in v0.6.0
func (entry *TableEntry) GetFullName() string
func (*TableEntry) GetID ¶ added in v0.8.0
func (entry *TableEntry) GetID() uint64
func (*TableEntry) GetLastestSchema ¶ added in v0.8.0
func (entry *TableEntry) GetLastestSchema(isTombstone bool) *Schema
GetLastestSchema returns the latest committed schema with entry locked
func (*TableEntry) GetLastestSchemaLocked ¶ added in v1.2.0
func (entry *TableEntry) GetLastestSchemaLocked(isTombstone bool) *Schema
GetLastestSchemaLocked returns the latest committed schema with entry Not locked
func (*TableEntry) GetNameDesc ¶
func (entry *TableEntry) GetNameDesc() string
func (*TableEntry) GetObjectByID ¶ added in v1.1.0
func (entry *TableEntry) GetObjectByID(id *types.Objectid, isTombstone bool) (obj *ObjectEntry, err error)
func (*TableEntry) GetRows ¶
func (entry *TableEntry) GetRows() uint64
func (*TableEntry) GetSoftdeleteObjects ¶
func (entry *TableEntry) GetSoftdeleteObjects(dedupedTS, collectTS types.TS) (objs []*ObjectEntry)
func (*TableEntry) GetTableData ¶
func (entry *TableEntry) GetTableData() data.Table
func (*TableEntry) GetVersionSchema ¶ added in v0.8.0
func (entry *TableEntry) GetVersionSchema(ver uint32) *Schema
func (*TableEntry) GetVisibilityAndName ¶ added in v0.8.0
func (entry *TableEntry) GetVisibilityAndName(txn txnif.TxnReader) (visible, dropped bool, name string)
func (*TableEntry) GetVisibleSchema ¶ added in v0.8.0
func (entry *TableEntry) GetVisibleSchema(txn txnif.TxnReader, isTombstone bool) (schema *Schema)
GetVisibleSchema returns committed schema visible at the given txn
func (*TableEntry) IsActive ¶
func (entry *TableEntry) IsActive() bool
IsActive is coarse API: no consistency check
func (*TableEntry) IsTableTailFlushed ¶
func (entry *TableEntry) IsTableTailFlushed(start, end types.TS) (bool, *ObjectEntry)
func (*TableEntry) IsVirtual ¶
func (entry *TableEntry) IsVirtual() bool
func (*TableEntry) Less ¶ added in v0.8.0
func (entry *TableEntry) Less(b *TableEntry) int
func (*TableEntry) MakeCommand ¶
func (entry *TableEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)
func (*TableEntry) MakeDataObjectIt ¶
func (entry *TableEntry) MakeDataObjectIt() btree.IterG[*ObjectEntry]
func (*TableEntry) MakeDataVisibleObjectIt ¶
func (entry *TableEntry) MakeDataVisibleObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
func (*TableEntry) MakeTombstoneObjectIt ¶
func (entry *TableEntry) MakeTombstoneObjectIt() btree.IterG[*ObjectEntry]
func (*TableEntry) MakeTombstoneVisibleObjectIt ¶
func (entry *TableEntry) MakeTombstoneVisibleObjectIt(txn txnif.TxnReader) *VisibleCommittedObjectIt
committed visible object iterator
func (*TableEntry) ObjectCnt ¶
func (entry *TableEntry) ObjectCnt(isTombstone bool) int
func (*TableEntry) ObjectStats ¶ added in v1.0.2
func (*TableEntry) ObjectStatsString ¶ added in v1.0.0
func (*TableEntry) PrepareRollback ¶
func (entry *TableEntry) PrepareRollback() (err error)
func (*TableEntry) RecurLoop ¶
func (entry *TableEntry) RecurLoop(processor Processor) (err error)
func (*TableEntry) RemoveEntry ¶
func (entry *TableEntry) RemoveEntry(objectEntry *ObjectEntry) (err error)
func (*TableEntry) RemoveRows ¶
func (entry *TableEntry) RemoveRows(delta uint64) uint64
func (*TableEntry) ShowObjectList ¶
func (entry *TableEntry) ShowObjectList(isTombstone bool) string
func (*TableEntry) String ¶
func (entry *TableEntry) String() string
func (*TableEntry) StringLocked ¶
func (entry *TableEntry) StringLocked() string
func (*TableEntry) StringLockedWithLevel ¶ added in v0.6.0
func (entry *TableEntry) StringLockedWithLevel(level common.PPLevel) string
func (*TableEntry) StringWithLevel ¶ added in v0.6.0
func (entry *TableEntry) StringWithLevel(level common.PPLevel) string
func (*TableEntry) TryFindLastAppendableObject ¶
func (entry *TableEntry) TryFindLastAppendableObject(isTombstone bool) (obj *ObjectEntry)
TryFindLastAppendableObject tries to find a serving appendable object in the tail of the list, specifically determined by time range [now-5min, now] Note: It not a big deal to return nil to indicate no object found, because the caller will handle it by creating a new one.
func (*TableEntry) UpdateReplayEntryTs ¶
func (entry *TableEntry) UpdateReplayEntryTs(objectEntry *ObjectEntry, ts types.TS)
func (*TableEntry) WaitDataObjectCommitted ¶
func (entry *TableEntry) WaitDataObjectCommitted(ts types.TS)
func (*TableEntry) WaitTombstoneObjectCommitted ¶
func (entry *TableEntry) WaitTombstoneObjectCommitted(ts types.TS)
type TableMVCCNode ¶ added in v0.6.0
func NewEmptyTableMVCCNode ¶ added in v0.6.0
func NewEmptyTableMVCCNode() *TableMVCCNode
func (*TableMVCCNode) ApproxSize ¶
func (e *TableMVCCNode) ApproxSize() int64
func (*TableMVCCNode) CloneAll ¶ added in v0.6.0
func (e *TableMVCCNode) CloneAll() *TableMVCCNode
func (*TableMVCCNode) CloneData ¶ added in v0.6.0
func (e *TableMVCCNode) CloneData() *TableMVCCNode
func (*TableMVCCNode) GetTombstoneSchema ¶
func (e *TableMVCCNode) GetTombstoneSchema() *Schema
func (*TableMVCCNode) ReadFromWithVersion ¶ added in v1.0.0
func (*TableMVCCNode) String ¶ added in v0.6.0
func (e *TableMVCCNode) String() string
func (*TableMVCCNode) Update ¶ added in v0.6.0
func (e *TableMVCCNode) Update(un *TableMVCCNode)
for create drop in one txn
type TableNode ¶ added in v0.8.0
type TableNode struct {
// contains filtered or unexported fields
}
func (*TableNode) ApproxSize ¶
type VisibleCommittedObjectIt ¶
type VisibleCommittedObjectIt struct {
// contains filtered or unexported fields
}
func (*VisibleCommittedObjectIt) Item ¶
func (it *VisibleCommittedObjectIt) Item() *ObjectEntry
func (*VisibleCommittedObjectIt) Next ¶
func (it *VisibleCommittedObjectIt) Next() bool
func (*VisibleCommittedObjectIt) Release ¶
func (it *VisibleCommittedObjectIt) Release()