catalog

package
v1.2.3-hotfix-20241010 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

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

View Source
const (
	SnapshotAttr_TID            = "table_id"
	SnapshotAttr_DBID           = "db_id"
	ObjectAttr_ID               = "id"
	ObjectAttr_CreateAt         = "create_at"
	ObjectAttr_SegNode          = "seg_node"
	SnapshotAttr_BlockMaxRow    = "block_max_row"
	SnapshotAttr_ObjectMaxBlock = "Object_max_block"
	SnapshotAttr_SchemaExtra    = "schema_extra"
	AccountIDDbNameTblName      = "account_id_db_name_tbl_name"
	AccountIDDbName             = "account_id_db_name"
	ObjectAttr_ObjectStats      = "object_stats"
	ObjectAttr_State            = "state"
	ObjectAttr_Sorted           = "sorted"
	EntryNode_CreateAt          = "create_at"
	EntryNode_DeleteAt          = "delete_at"
)

+--------+---------+----------+----------+------------+ | ID | Name | CreateAt | DeleteAt | CommitInfo | +--------+---------+----------+----------+------------+ |(uint64)|(varchar)| (uint64) | (uint64) | (varchar) | +--------+---------+----------+----------+------------+

View Source
const (
	IOET_WALTxnCommand_Database uint16 = 3009
	IOET_WALTxnCommand_Table    uint16 = 3010
	IOET_WALTxnCommand_Segment  uint16 = 3011
	IOET_WALTxnCommand_Block    uint16 = 3012
	IOET_WALTxnCommand_Object   uint16 = 3015

	IOET_WALTxnCommand_Database_V1 uint16 = 1
	IOET_WALTxnCommand_Table_V1    uint16 = 1
	IOET_WALTxnCommand_Table_V2    uint16 = 2
	IOET_WALTxnCommand_Table_V3    uint16 = 3
	IOET_WALTxnCommand_Segment_V1  uint16 = 1
	IOET_WALTxnCommand_Block_V1    uint16 = 1
	IOET_WALTxnCommand_Object_V1   uint16 = 1

	IOET_WALTxnCommand_Database_CurrVer = IOET_WALTxnCommand_Database_V1
	IOET_WALTxnCommand_Table_CurrVer    = IOET_WALTxnCommand_Table_V3
	IOET_WALTxnCommand_Segment_CurrVer  = IOET_WALTxnCommand_Segment_V1
	IOET_WALTxnCommand_Block_CurrVer    = IOET_WALTxnCommand_Block_V1
	IOET_WALTxnCommand_Object_CurrVer   = IOET_WALTxnCommand_Object_V1
)
View Source
const (
	PhyAddrColumnName    = catalog.Row_ID
	PhyAddrColumnComment = "Physical address"
	SortKeyNamePrefx     = "_SORT_"

	AttrRowID    = PhyAddrColumnName
	AttrCommitTs = catalog.TableTailAttrCommitTs
	AttrAborted  = catalog.TableTailAttrAborted
	AttrPKVal    = catalog.TableTailAttrPKVal

	TenantSysID = uint32(0)
)
View Source
const (
	ModelSchemaName   = "_ModelSchema"
	ModelAttrET       = "ET"
	ModelAttrID       = "ID"
	ModelAttrName     = "NAME"
	ModelAttrTS       = "TS"
	ModelAttrOpT      = "OPT"
	ModelAttrLogIdx   = "LOGIDX"
	ModelAttrInfo     = "INFO"
	ModelAttrParentID = "PARENTID"
)
View Source
const (
	AccessInfoSize int64 = int64(unsafe.Sizeof(accessInfo{}))
)
View Source
const (
	BlockNodeSize int64 = int64(unsafe.Sizeof(BlockNode{}))
)
View Source
const (
	EntryMVCCNodeSize int = int(unsafe.Sizeof(EntryMVCCNode{}))
)

Variables

View Source
var SystemBlock_Columns_ID types.Blockid
View Source
var SystemBlock_DB_ID types.Blockid
View Source
var SystemBlock_Table_ID types.Blockid
View Source
var SystemObject_Columns_ID types.Uuid
View Source
var SystemObject_DB_ID types.Uuid
View Source
var SystemObject_Table_ID types.Uuid

Functions

func ActiveObjectWithNoTxnFilter added in v1.1.0

func ActiveObjectWithNoTxnFilter(be *BaseEntryImpl[*ObjectMVCCNode]) bool

func ActiveWithNoTxnFilter

func ActiveWithNoTxnFilter(be *BaseEntryImpl[*ObjectMVCCNode]) bool

func AppendableBlkFilter

func AppendableBlkFilter(be *ObjectEntry) bool

func CmdName

func CmdName(t uint16) string

func CompareBaseNode added in v0.8.0

func CompareBaseNode[T BaseNode[T]](e, o *MVCCNode[T]) int

func CompareUint64

func CompareUint64(left, right uint64) int

func EncodeAccessInfo added in v0.8.0

func EncodeAccessInfo(ai *accessInfo) []byte

func EncodeBlockNode added in v0.8.0

func EncodeBlockNode(node *BlockNode) []byte

func EncodeEntryMVCCNode added in v0.8.0

func EncodeEntryMVCCNode(node *EntryMVCCNode) []byte

func GetAttrIdx

func GetAttrIdx(attrs []string, name string) int

func IsFakePkName added in v0.8.0

func IsFakePkName(name string) bool

func MockBatch

func MockBatch(schema *Schema, rows int) *containers.Batch

func MockTxnFactory

func MockTxnFactory(catalog *Catalog) txnbase.TxnFactory

func MockTxnStoreFactory

func MockTxnStoreFactory(catalog *Catalog) txnbase.TxnStoreFactory

func NewEmptyMVCCNodeFactory added in v0.8.0

func NewEmptyMVCCNodeFactory[T BaseNode[T]](factory func() T) func() *MVCCNode[T]

func NonAppendableBlkFilter

func NonAppendableBlkFilter(be *ObjectEntry) bool

Types

type BaseEntry

type BaseEntry interface {
	//for global checkpoint
	RLock()
	RUnlock()
	DeleteBeforeLocked(ts types.TS) bool
	DeleteBefore(ts types.TS) bool
}

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]) CreateWithStartAndEnd added in v1.1.0

func (be *BaseEntryImpl[T]) CreateWithStartAndEnd(start, end types.TS, baseNode T)

used when replay

func (*BaseEntryImpl[T]) CreateWithTS added in v0.8.0

func (be *BaseEntryImpl[T]) CreateWithTS(ts types.TS, baseNode T)

func (*BaseEntryImpl[T]) CreateWithTxn added in v0.8.0

func (be *BaseEntryImpl[T]) CreateWithTxn(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]) HasDropIntentLocked added in v1.2.2

func (be *BaseEntryImpl[T]) HasDropIntentLocked() bool

func (*BaseEntryImpl[T]) IsVisibleWithLock added in v1.2.0

func (be *BaseEntryImpl[T]) IsVisibleWithLock(txn txnif.TxnReader, mu *sync.RWMutex) (ok bool, err error)

func (*BaseEntryImpl[T]) NeedWaitCommittingLocked added in v1.2.0

func (be *BaseEntryImpl[T]) NeedWaitCommittingLocked(startTS types.TS) (bool, txnif.TxnReader)

func (*BaseEntryImpl[T]) PPString added in v0.8.0

func (be *BaseEntryImpl[T]) PPString(level common.PPLevel, depth int, prefix string) string

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

func (*BaseEntryImpl[T]) TryGetTerminatedTS added in v0.8.0

func (be *BaseEntryImpl[T]) TryGetTerminatedTS(waitIfcommitting bool) (terminated bool, TS types.TS)

func (*BaseEntryImpl[T]) TryGetTerminatedTSLocked added in v1.2.0

func (be *BaseEntryImpl[T]) TryGetTerminatedTSLocked(waitIfcommitting bool) (terminated bool, TS types.TS)

type BaseNode added in v0.8.0

type BaseNode[T any] interface {
	CloneAll() T
	CloneData() T
	String() string
	Update(vun T)
	IdempotentUpdate(vun T)
	WriteTo(w io.Writer) (n int64, err error)
	ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
}

type BlockNode added in v0.8.0

type BlockNode struct {
	// contains filtered or unexported fields
}

func (*BlockNode) ReadFrom added in v0.8.0

func (node *BlockNode) ReadFrom(r io.Reader) (n int64, err error)

func (*BlockNode) WriteTo added in v0.8.0

func (node *BlockNode) WriteTo(w io.Writer) (n int64, err error)

type Catalog

type Catalog struct {
	*IDAlloctor
	*sync.RWMutex
	// contains filtered or unexported fields
}

func MockCatalog

func MockCatalog() *Catalog

func OpenCatalog

func OpenCatalog(usageMemo any) (*Catalog, error)

func (*Catalog) AddEntryLocked

func (catalog *Catalog) AddEntryLocked(database *DBEntry, txn txnif.TxnReader, skipDedup bool) error

func (*Catalog) Close

func (catalog *Catalog) Close() error

func (*Catalog) CreateDBEntry

func (catalog *Catalog) CreateDBEntry(name, createSql, datTyp string, txn txnif.AsyncTxn) (*DBEntry, error)

func (*Catalog) CreateDBEntryWithID added in v0.6.0

func (catalog *Catalog) CreateDBEntryWithID(name, createSql, datTyp string, id uint64, txn txnif.AsyncTxn) (*DBEntry, error)

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 *Catalog) DropDBEntryByID(id uint64, txn txnif.AsyncTxn) (isNewMVCCNode bool, deleted *DBEntry, err error)

func (*Catalog) DropDBEntryByName added in v1.2.0

func (catalog *Catalog) DropDBEntryByName(
	name string,
	txn txnif.AsyncTxn) (isNewMVCCNode bool, deleted *DBEntry, err error)

func (*Catalog) GCByTS added in v0.7.0

func (catalog *Catalog) GCByTS(ctx context.Context, ts types.TS)

func (*Catalog) GetDatabaseByID

func (catalog *Catalog) GetDatabaseByID(id uint64) (db *DBEntry, err error)

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 *Catalog) GetUsageMemo() any

func (*Catalog) InitSystemDB

func (catalog *Catalog) InitSystemDB()

func (*Catalog) MakeDBIt

func (catalog *Catalog) MakeDBIt(reverse bool) *common.GenericSortedDListIt[*DBEntry]

func (*Catalog) OnReplayBlockBatch added in v0.6.0

func (catalog *Catalog) OnReplayBlockBatch(ins, insTxn, del, delTxn *containers.Batch, dataFactory DataFactory)

func (*Catalog) OnReplayDatabaseBatch added in v0.6.0

func (catalog *Catalog) OnReplayDatabaseBatch(ins, insTxn, del, delTxn *containers.Batch)

func (*Catalog) OnReplayObjectBatch added in v1.1.0

func (catalog *Catalog) OnReplayObjectBatch(objectInfo *containers.Batch, dataFactory DataFactory)

func (*Catalog) OnReplayTableBatch added in v0.6.0

func (catalog *Catalog) OnReplayTableBatch(ins, insTxn, insCol, del, delTxn *containers.Batch, dataFactory DataFactory)

func (*Catalog) PPString

func (catalog *Catalog) PPString(level common.PPLevel, depth int, prefix string) string

func (*Catalog) RecurLoop

func (catalog *Catalog) RecurLoop(processor Processor) (err error)

func (*Catalog) RemoveDBEntry added in v1.2.0

func (catalog *Catalog) RemoveDBEntry(database *DBEntry) error

RemoveDBEntry removes a database entry from the catalog physically, triggered by GC Task

func (*Catalog) ReplayCmd

func (catalog *Catalog) ReplayCmd(
	txncmd txnif.TxnCmd,
	dataFactory DataFactory,
	observer wal.ReplayObserver)

func (*Catalog) ReplayTableRows

func (catalog *Catalog) ReplayTableRows()

func (*Catalog) SetUsageMemo added in v1.1.0

func (catalog *Catalog) SetUsageMemo(memo any)

func (*Catalog) SimplePPString

func (catalog *Catalog) SimplePPString(level common.PPLevel) string

func (*Catalog) TxnGetDBEntryByID added in v0.6.0

func (catalog *Catalog) TxnGetDBEntryByID(id uint64, txn txnif.AsyncTxn) (*DBEntry, error)

func (*Catalog) TxnGetDBEntryByName added in v0.6.0

func (catalog *Catalog) TxnGetDBEntryByName(name string, txn txnif.AsyncTxn) (*DBEntry, error)

type ColDef

type ColDef struct {
	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
	EnumValues    string
}

func ColDefFromAttribute added in v0.7.0

func ColDefFromAttribute(attr engine.Attribute) (*ColDef, error)

make a basic coldef without sortKey info

func (*ColDef) GetName

func (def *ColDef) GetName() string

func (*ColDef) GetType

func (def *ColDef) GetType() types.Type

func (*ColDef) IsAutoIncrement added in v0.6.0

func (def *ColDef) IsAutoIncrement() bool

func (*ColDef) IsClusterBy added in v0.7.0

func (def *ColDef) IsClusterBy() bool

func (*ColDef) IsHidden

func (def *ColDef) IsHidden() bool

func (*ColDef) IsPhyAddr added in v0.6.0

func (def *ColDef) IsPhyAddr() bool

func (*ColDef) IsPrimary

func (def *ColDef) IsPrimary() bool

func (*ColDef) IsRealPrimary added in v0.8.0

func (def *ColDef) IsRealPrimary() bool

func (*ColDef) IsSortKey

func (def *ColDef) IsSortKey() bool

func (*ColDef) Nullable

func (def *ColDef) Nullable() bool

type ComposedFilter

type ComposedFilter struct {
	CommitFilters []func(*BaseEntryImpl[*ObjectMVCCNode]) bool
	BlockFilters  []func(*ObjectEntry) bool
}

func NewComposedFilter

func NewComposedFilter() *ComposedFilter

func (*ComposedFilter) AddBlockFilter

func (filter *ComposedFilter) AddBlockFilter(f func(*ObjectEntry) bool)

func (*ComposedFilter) AddCommitFilter

func (filter *ComposedFilter) AddCommitFilter(f func(*BaseEntryImpl[*ObjectMVCCNode]) bool)

func (*ComposedFilter) FilteBlock

func (filter *ComposedFilter) FilteBlock(be *ObjectEntry) bool

func (*ComposedFilter) FilteCommit

func (filter *ComposedFilter) FilteCommit(be *BaseEntryImpl[*ObjectMVCCNode]) bool

type DBEntry

type DBEntry struct {
	ID uint64
	*BaseEntryImpl[*EmptyMVCCNode]

	*DBNode
	// contains filtered or unexported fields
}

func MockDBEntryWithAccInfo added in v1.1.0

func MockDBEntryWithAccInfo(accId uint64, dbId uint64) *DBEntry

only for test

func NewDBEntryWithID added in v0.6.0

func NewDBEntryWithID(catalog *Catalog, name string, createSql, datTyp string, id uint64, txn txnif.AsyncTxn) *DBEntry

func NewReplayDBEntry

func NewReplayDBEntry() *DBEntry

func NewSystemDBEntry

func NewSystemDBEntry(catalog *Catalog) *DBEntry

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.

  1. Wait for the related txn if need.
  2. 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 (e *DBEntry) AsCommonID() *common.ID

func (*DBEntry) CoarseTableCnt

func (e *DBEntry) CoarseTableCnt() int

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

  1. 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 (e *DBEntry) DropTableEntryByID(id uint64, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)

func (*DBEntry) GetBlockEntryByID

func (e *DBEntry) GetBlockEntryByID(id *common.ID) (obj *ObjectEntry, err error)

func (*DBEntry) GetCatalog

func (e *DBEntry) GetCatalog() *Catalog

func (*DBEntry) GetCreateAt added in v0.6.0

func (e *DBEntry) GetCreateAt() types.Timestamp

func (*DBEntry) GetCreateSql added in v0.6.0

func (e *DBEntry) GetCreateSql() string

func (*DBEntry) GetDatType added in v0.8.0

func (e *DBEntry) GetDatType() string

func (*DBEntry) GetFullName added in v0.6.0

func (e *DBEntry) GetFullName() string

func (*DBEntry) GetID added in v0.8.0

func (e *DBEntry) GetID() uint64

func (*DBEntry) GetItemNodeByIDLocked added in v0.6.0

func (e *DBEntry) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*TableEntry]

func (*DBEntry) GetName

func (e *DBEntry) GetName() string

func (*DBEntry) GetObjectEntryByID added in v1.2.0

func (e *DBEntry) GetObjectEntryByID(id *common.ID) (obj *ObjectEntry, err error)

func (*DBEntry) GetRoleID added in v0.6.0

func (e *DBEntry) GetRoleID() uint32

func (*DBEntry) GetTableEntryByID

func (e *DBEntry) GetTableEntryByID(id uint64) (table *TableEntry, err error)

func (*DBEntry) GetTableEntryByName added in v0.6.0

func (e *DBEntry) GetTableEntryByName(
	tenantID uint32,
	name string,
	txn txnif.TxnReader) (entry *TableEntry, err error)

func (*DBEntry) GetTenantID added in v0.6.0

func (e *DBEntry) GetTenantID() uint32

func (*DBEntry) GetUserID added in v0.6.0

func (e *DBEntry) GetUserID() uint32

func (*DBEntry) Is1PC added in v0.6.0

func (e *DBEntry) Is1PC() bool

func (*DBEntry) IsActive

func (e *DBEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*DBEntry) IsSubscription added in v0.8.0

func (e *DBEntry) IsSubscription() bool

func (*DBEntry) IsSystemDB

func (e *DBEntry) IsSystemDB() bool

func (*DBEntry) Less added in v0.8.0

func (e *DBEntry) Less(b *DBEntry) int

func (*DBEntry) MakeCommand

func (e *DBEntry) MakeCommand(id uint32) (txnif.TxnCmd, error)

func (*DBEntry) MakeTableIt

func (e *DBEntry) MakeTableIt(reverse bool) *common.GenericSortedDListIt[*TableEntry]

func (*DBEntry) PPString

func (e *DBEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*DBEntry) PrepareRollback

func (e *DBEntry) PrepareRollback() (err error)

func (*DBEntry) PrettyNameIndex added in v0.8.0

func (e *DBEntry) PrettyNameIndex() string

For test only

func (*DBEntry) RecurLoop

func (e *DBEntry) RecurLoop(processor Processor) (err error)

func (*DBEntry) RemoveEntry

func (e *DBEntry) RemoveEntry(table *TableEntry) (err error)

func (*DBEntry) RenameTableInTxn added in v0.8.0

func (e *DBEntry) RenameTableInTxn(old, new string, tid uint64, tenantID uint32, txn txnif.TxnReader, first bool) error

func (*DBEntry) RollbackRenameTable added in v0.8.0

func (e *DBEntry) RollbackRenameTable(fullname string, tid uint64)

func (*DBEntry) Set1PC added in v0.6.0

func (e *DBEntry) Set1PC()

func (*DBEntry) String

func (e *DBEntry) String() string

func (*DBEntry) StringLocked

func (e *DBEntry) StringLocked() string

func (*DBEntry) StringWithLevel added in v0.6.0

func (e *DBEntry) StringWithLevel(level common.PPLevel) string

func (*DBEntry) StringWithlevelLocked added in v0.6.0

func (e *DBEntry) StringWithlevelLocked(level common.PPLevel) string

func (*DBEntry) TxnGetTableEntryByID added in v0.6.0

func (e *DBEntry) TxnGetTableEntryByID(id uint64, txn txnif.AsyncTxn) (entry *TableEntry, err error)

func (*DBEntry) TxnGetTableEntryByName added in v0.6.0

func (e *DBEntry) TxnGetTableEntryByName(name string, txn txnif.AsyncTxn) (entry *TableEntry, err error)

type DBNode added in v0.8.0

type DBNode struct {
	// contains filtered or unexported fields
}

func (*DBNode) ReadFrom added in v0.8.0

func (node *DBNode) ReadFrom(r io.Reader) (n int64, err error)

func (*DBNode) TestSetAccId added in v1.1.1

func (node *DBNode) TestSetAccId(id uint32)

only used in ut test

func (*DBNode) WriteTo added in v0.8.0

func (node *DBNode) WriteTo(w io.Writer) (n int64, err error)

type DataFactory

type DataFactory interface {
	MakeTableFactory() TableDataFactory
	MakeObjectFactory() ObjectDataFactory
	MakeTombstoneFactory() TombstoneFactory
}

type DeleteEntry added in v1.2.0

type DeleteEntry struct {
	ObjectID objectio.ObjectId
	data.Tombstone
}

func (DeleteEntry) Less added in v1.2.0

func (d DeleteEntry) Less(o DeleteEntry) bool

type EmptyMVCCNode added in v0.8.0

type EmptyMVCCNode struct{}

func NewEmptyEmptyMVCCNode added in v0.8.0

func NewEmptyEmptyMVCCNode() *EmptyMVCCNode

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) IdempotentUpdate added in v1.1.1

func (e *EmptyMVCCNode) IdempotentUpdate(vun *EmptyMVCCNode)

func (*EmptyMVCCNode) ReadFromWithVersion added in v1.0.0

func (e *EmptyMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

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

func (*EmptyMVCCNode) WriteTo added in v0.8.0

func (e *EmptyMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type EntryCommand

type EntryCommand[T BaseNode[T], N Node] struct {
	*txnbase.BaseCustomizedCmd

	ID *common.ID
	// contains filtered or unexported fields
}

func NewDeltalocCmd added in v1.2.0

func NewDeltalocCmd(id uint32, cmdType uint16, commonID *common.ID, baseEntry *BaseEntryImpl[*MetadataMVCCNode]) *EntryCommand[*MetadataMVCCNode, *BlockNode]

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]) 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]) 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]) 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

func (*EntryCommand[T, N]) WriteTo

func (cmd *EntryCommand[T, N]) WriteTo(w io.Writer) (n int64, err error)

type EntryMVCCNode added in v0.6.0

type EntryMVCCNode struct {
	CreatedAt, DeletedAt types.TS
}

func DecodeEntryMVCCNode added in v0.8.0

func DecodeEntryMVCCNode(v []byte) *EntryMVCCNode

func ReadEntryNodeTuple added in v1.1.0

func ReadEntryNodeTuple(bat *containers.Batch, row int) (un *EntryMVCCNode)

func (*EntryMVCCNode) AppendTuple added in v1.1.0

func (un *EntryMVCCNode) AppendTuple(bat *containers.Batch)

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) CloneData added in v0.6.0

func (un *EntryMVCCNode) CloneData() *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

func (*EntryMVCCNode) WriteTo added in v0.6.0

func (un *EntryMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type EntryState

type EntryState int8
const (
	ES_Appendable EntryState = iota
	ES_NotAppendable
	ES_Frozen
)

func (EntryState) Repr

func (es EntryState) Repr() string

type IDAlloctor

type IDAlloctor struct {
	// contains filtered or unexported fields
}

func NewIDAllocator

func NewIDAllocator() *IDAlloctor

func (*IDAlloctor) CurrBlock

func (alloc *IDAlloctor) CurrBlock() uint64

func (*IDAlloctor) CurrDB

func (alloc *IDAlloctor) CurrDB() uint64

func (*IDAlloctor) CurrObject added in v1.1.0

func (alloc *IDAlloctor) CurrObject() uint64

func (*IDAlloctor) CurrTable

func (alloc *IDAlloctor) CurrTable() uint64

func (*IDAlloctor) IDStates

func (alloc *IDAlloctor) IDStates() string

func (*IDAlloctor) Init

func (alloc *IDAlloctor) Init(prevDb, prevTbl, prevObj, prevBlk uint64)

func (*IDAlloctor) NextBlock

func (alloc *IDAlloctor) NextBlock() uint64

func (*IDAlloctor) NextDB

func (alloc *IDAlloctor) NextDB() uint64

func (*IDAlloctor) NextObject added in v1.1.0

func (alloc *IDAlloctor) NextObject() uint64

func (*IDAlloctor) NextTable

func (alloc *IDAlloctor) NextTable() uint64

func (*IDAlloctor) OnReplayBlockID

func (alloc *IDAlloctor) OnReplayBlockID(id uint64)

func (*IDAlloctor) OnReplayDBID

func (alloc *IDAlloctor) OnReplayDBID(id uint64)

func (*IDAlloctor) OnReplayObjectID added in v1.1.0

func (alloc *IDAlloctor) OnReplayObjectID(id uint64)

func (*IDAlloctor) OnReplayTableID

func (alloc *IDAlloctor) OnReplayTableID(id uint64)

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(data.Tombstone) 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 data.Tombstone) error

type MVCCNode added in v0.8.0

type MVCCNode[T BaseNode[T]] struct {
	*EntryMVCCNode
	*txnbase.TxnMVCCNode
	BaseNode T
}

func (*MVCCNode[T]) ApplyCommit added in v0.8.0

func (e *MVCCNode[T]) ApplyCommit(id string) (err error)

func (*MVCCNode[T]) ApplyRollback added in v0.8.0

func (e *MVCCNode[T]) ApplyRollback() (err error)

func (*MVCCNode[T]) CloneAll added in v0.8.0

func (e *MVCCNode[T]) CloneAll() *MVCCNode[T]

func (*MVCCNode[T]) CloneData added in v0.8.0

func (e *MVCCNode[T]) CloneData() *MVCCNode[T]

func (*MVCCNode[T]) IdempotentUpdate added in v1.1.1

func (e *MVCCNode[T]) IdempotentUpdate(un *MVCCNode[T])

func (*MVCCNode[T]) IsNil added in v0.8.0

func (e *MVCCNode[T]) IsNil() bool

func (*MVCCNode[T]) PrepareCommit added in v0.8.0

func (e *MVCCNode[T]) PrepareCommit() (err error)

func (*MVCCNode[T]) PrepareRollback added in v0.8.0

func (e *MVCCNode[T]) PrepareRollback() (err error)

func (*MVCCNode[T]) ReadFromWithVersion added in v1.0.0

func (e *MVCCNode[T]) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

func (*MVCCNode[T]) String added in v0.8.0

func (e *MVCCNode[T]) String() string

func (*MVCCNode[T]) Update added in v0.8.0

func (e *MVCCNode[T]) Update(un *MVCCNode[T])

for create drop in one txn

func (*MVCCNode[T]) WriteTo added in v0.8.0

func (e *MVCCNode[T]) WriteTo(w io.Writer) (n int64, err error)

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) 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) IdempotentUpdate added in v1.1.1

func (e *MetadataMVCCNode) IdempotentUpdate(un *MetadataMVCCNode)

func (*MetadataMVCCNode) ReadFromWithVersion added in v1.0.0

func (e *MetadataMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

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

func (*MetadataMVCCNode) WriteTo added in v0.6.0

func (e *MetadataMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type Node added in v0.8.0

type Node interface {
	WriteTo(w io.Writer) (n int64, err error)
	ReadFrom(r io.Reader) (n int64, err error)
}

type ObjectDataFactory added in v1.2.0

type ObjectDataFactory = func(meta *ObjectEntry) data.Object

type ObjectEntry added in v1.1.0

type ObjectEntry struct {
	ID types.Objectid

	*BaseEntryImpl[*ObjectMVCCNode]

	*ObjectNode

	HasPrintedPrepareComapct bool
	// contains filtered or unexported fields
}

func MockObjEntryWithTbl added in v1.1.0

func MockObjEntryWithTbl(tbl *TableEntry, size uint64) *ObjectEntry

func NewObjectEntry added in v1.1.0

func NewObjectEntry(
	table *TableEntry,
	id *objectio.ObjectId,
	txn txnif.AsyncTxn,
	state EntryState,
	dataFactory ObjectDataFactory,
) *ObjectEntry

func NewObjectEntryByMetaLocation added in v1.1.0

func NewObjectEntryByMetaLocation(
	table *TableEntry,
	id *objectio.ObjectId,
	start, end types.TS,
	state EntryState,
	metalocation objectio.Location,
	dataFactory ObjectDataFactory,
) *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) *ObjectEntry

func NewSysObjectEntry added in v1.1.0

func NewSysObjectEntry(table *TableEntry, id types.Uuid) *ObjectEntry

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) CheckAndLoad added in v1.1.0

func (entry *ObjectEntry) CheckAndLoad() error

func (*ObjectEntry) CheckPrintPrepareCompact added in v1.2.1

func (entry *ObjectEntry) CheckPrintPrepareCompact() bool

func (*ObjectEntry) CheckPrintPrepareCompactLocked added in v1.2.1

func (entry *ObjectEntry) CheckPrintPrepareCompactLocked() bool

func (*ObjectEntry) GetCatalog added in v1.1.0

func (entry *ObjectEntry) GetCatalog() *Catalog

func (*ObjectEntry) GetCompSize added in v1.1.0

func (entry *ObjectEntry) GetCompSize() int

func (*ObjectEntry) GetInMemoryObjectInfo added in v1.1.0

func (entry *ObjectEntry) GetInMemoryObjectInfo() *ObjectMVCCNode

for test

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) 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) GetOriginSize added in v1.1.0

func (entry *ObjectEntry) GetOriginSize() int

func (*ObjectEntry) GetPKZoneMap added in v1.2.0

func (entry *ObjectEntry) GetPKZoneMap(
	ctx context.Context,
	fs fileservice.FileService,
) (zm index.ZM, err error)

func (*ObjectEntry) GetRemainingRows added in v1.1.0

func (entry *ObjectEntry) GetRemainingRows() int

func (*ObjectEntry) GetRows added in v1.1.0

func (entry *ObjectEntry) GetRows() int

func (*ObjectEntry) GetSchema added in v1.2.0

func (entry *ObjectEntry) GetSchema() *Schema

func (*ObjectEntry) GetSchemaLocked added in v1.2.0

func (entry *ObjectEntry) GetSchemaLocked() *Schema

func (*ObjectEntry) GetSortKeyZonemap added in v1.1.0

func (entry *ObjectEntry) GetSortKeyZonemap() index.ZM

func (*ObjectEntry) GetTable added in v1.1.0

func (entry *ObjectEntry) GetTable() *TableEntry

func (*ObjectEntry) GetTerminationTS added in v1.1.0

func (entry *ObjectEntry) GetTerminationTS() (ts types.TS, terminated bool)

GetTerminationTS is coarse API: no consistency check

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) HasPersistedData added in v1.2.0

func (entry *ObjectEntry) HasPersistedData() bool

func (*ObjectEntry) InMemoryDeletesExisted added in v1.2.0

func (entry *ObjectEntry) InMemoryDeletesExisted() bool

func (*ObjectEntry) InMemoryDeletesExistedLocked added in v1.2.1

func (entry *ObjectEntry) InMemoryDeletesExistedLocked() bool

func (*ObjectEntry) InitData added in v1.2.0

func (entry *ObjectEntry) InitData(factory DataFactory)

func (*ObjectEntry) Is1PC added in v1.1.0

func (entry *ObjectEntry) Is1PC() bool

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) IsDeletesFlushedBefore added in v1.2.1

func (entry *ObjectEntry) IsDeletesFlushedBefore(ts types.TS) 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) int

func (*ObjectEntry) LoadObjectInfoForLastNode added in v1.1.0

func (entry *ObjectEntry) LoadObjectInfoForLastNode() (stats objectio.ObjectStats, err error)

func (*ObjectEntry) LoadObjectInfoWithTxnTS added in v1.1.0

func (entry *ObjectEntry) LoadObjectInfoWithTxnTS(startTS types.TS) (objectio.ObjectStats, error)

func (*ObjectEntry) MakeCommand added in v1.1.0

func (entry *ObjectEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*ObjectEntry) MustGetObjectStats added in v1.2.0

func (entry *ObjectEntry) MustGetObjectStats() (objectio.ObjectStats, error)

func (*ObjectEntry) NeedPrefetchObjectMetaForObjectInfo added in v1.1.0

func (entry *ObjectEntry) NeedPrefetchObjectMetaForObjectInfo(nodes []*MVCCNode[*ObjectMVCCNode]) (needPrefetch bool)

func (*ObjectEntry) ObjectPersisted added in v1.2.0

func (entry *ObjectEntry) ObjectPersisted() bool

for old flushed objects, stats may be empty

func (*ObjectEntry) PPString added in v1.1.0

func (entry *ObjectEntry) PPString(level common.PPLevel, depth int, prefix string) string

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()

func (*ObjectEntry) Repr added in v1.1.0

func (entry *ObjectEntry) Repr() string

func (*ObjectEntry) Set1PC added in v1.1.0

func (entry *ObjectEntry) Set1PC()

func (*ObjectEntry) SetObjectStatsForPreviousNode added in v1.1.1

func (entry *ObjectEntry) SetObjectStatsForPreviousNode(nodes []*MVCCNode[*ObjectMVCCNode])

func (*ObjectEntry) SetRemainingRows added in v1.1.0

func (entry *ObjectEntry) SetRemainingRows(rows int)

func (*ObjectEntry) SetSorted added in v1.1.0

func (entry *ObjectEntry) SetSorted()

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) StringLocked added in v1.1.0

func (entry *ObjectEntry) StringLocked() string

func (*ObjectEntry) StringWithLevel added in v1.1.0

func (entry *ObjectEntry) StringWithLevel(level common.PPLevel) string

func (*ObjectEntry) StringWithLevelLocked added in v1.1.0

func (entry *ObjectEntry) StringWithLevelLocked(level common.PPLevel) string

func (*ObjectEntry) TreeMaxDropCommitEntry added in v1.1.0

func (entry *ObjectEntry) TreeMaxDropCommitEntry() BaseEntry

func (*ObjectEntry) UpdateObjectInfo added in v1.1.0

func (entry *ObjectEntry) UpdateObjectInfo(txn txnif.TxnReader, stats *objectio.ObjectStats) (isNewNode bool, err error)

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(bat *containers.Batch, row int) (e *ObjectMVCCNode)

func (*ObjectMVCCNode) AppendTuple added in v1.1.0

func (e *ObjectMVCCNode) AppendTuple(sid *types.Objectid, batch *containers.Batch)

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) IdempotentUpdate added in v1.1.1

func (e *ObjectMVCCNode) IdempotentUpdate(vun *ObjectMVCCNode)

func (*ObjectMVCCNode) IsEmpty added in v1.1.0

func (e *ObjectMVCCNode) IsEmpty() bool

func (*ObjectMVCCNode) ReadFromWithVersion added in v1.1.0

func (e *ObjectMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

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)

func (*ObjectMVCCNode) WriteTo added in v1.1.0

func (e *ObjectMVCCNode) WriteTo(w io.Writer) (n int64, err error)

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
	// contains filtered or unexported fields
}

func (*ObjectNode) ReadFrom added in v1.1.0

func (node *ObjectNode) ReadFrom(r io.Reader) (n int64, err error)

func (*ObjectNode) String added in v1.1.0

func (node *ObjectNode) String() string

func (*ObjectNode) WriteTo added in v1.1.0

func (node *ObjectNode) WriteTo(w io.Writer) (n int64, err error)

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 data.Tombstone) 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
	BlockMaxRows uint32
	// for aobj, there're at most one blk
	ObjectMaxBlocks uint16
	Extra           *apipb.SchemaExtra

	// do not write down, reconstruct them when reading
	NameMap    map[string]int // name -> logical idx
	SeqnumMap  map[uint16]int // seqnum -> logical idx
	SortKey    *SortKey
	PhyAddrKey *ColDef
	// contains filtered or unexported fields
}
var SystemColumnSchema *Schema
var SystemColumnSchema_V1 *Schema
var SystemDBSchema *Schema
var SystemTableSchema *Schema
var SystemTableSchema_V1 *Schema

func MockSchema

func MockSchema(colCnt int, pkIdx int) *Schema

func MockSchemaAll

func MockSchemaAll(colCnt int, pkIdx int, from ...int) *Schema

MockSchemaAll if char/varchar is needed, colCnt = 14, otherwise colCnt = 12 pkIdx == -1 means no pk defined

func MockSnapShotSchema added in v1.2.0

func MockSnapShotSchema(withoutTS ...bool) *Schema

func NewEmptySchema

func NewEmptySchema(name string) *Schema

func (*Schema) AllNames

func (s *Schema) AllNames() []string

func (*Schema) AllSeqnums added in v0.8.0

func (s *Schema) AllSeqnums() []uint16

func (*Schema) AllTypes

func (s *Schema) AllTypes() []types.Type

func (*Schema) AppendCol

func (s *Schema) AppendCol(name string, typ types.Type) error

func (*Schema) AppendColDef

func (s *Schema) AppendColDef(def *ColDef) (err error)

func (*Schema) AppendColWithAttribute added in v0.6.0

func (s *Schema) AppendColWithAttribute(attr engine.Attribute) error

func (*Schema) AppendFakePKCol added in v0.8.0

func (s *Schema) AppendFakePKCol() error

func (*Schema) AppendPKCol

func (s *Schema) AppendPKCol(name string, typ types.Type, idx int) error

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 (s *Schema) AppendSortKey(name string, typ types.Type, idx int, isPrimary bool) error

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) Attrs

func (s *Schema) Attrs() []string

func (*Schema) Clone

func (s *Schema) Clone() *Schema

func (*Schema) EstimateRowSize added in v1.0.0

func (s *Schema) EstimateRowSize() (size int)

func (*Schema) Finalize

func (s *Schema) Finalize(withoutPhyAddr bool) (err error)

Finalize runs various checks and create shortcuts to phyaddr and sortkey Note: NameMap is already set before calling Finalize

func (*Schema) GetColIdx

func (s *Schema) GetColIdx(attr string) int

GetColIdx returns column index for the given column name if found, otherwise returns -1.

func (*Schema) GetPrimaryKey added in v0.8.0

func (s *Schema) GetPrimaryKey() *ColDef

GetPrimaryKey gets the primary key, including fake primary key.

func (*Schema) GetSeqnum added in v0.8.0

func (s *Schema) GetSeqnum(attr string) uint16

func (*Schema) GetSingleSortKey

func (s *Schema) GetSingleSortKey() *ColDef

GetSingleSortKey should be call only if IsSinglePK is checked

func (*Schema) GetSingleSortKeyIdx

func (s *Schema) GetSingleSortKeyIdx() int

func (*Schema) GetSingleSortKeyType added in v0.7.0

func (s *Schema) GetSingleSortKeyType() types.Type

func (*Schema) HasPK

func (s *Schema) HasPK() bool

func (*Schema) HasSortKey

func (s *Schema) HasSortKey() bool

func (*Schema) IsSameColumns added in v0.8.0

func (s *Schema) IsSameColumns(other *Schema) bool

func (*Schema) IsSecondaryIndexTable added in v1.2.0

func (s *Schema) IsSecondaryIndexTable() bool

func (*Schema) Marshal

func (s *Schema) Marshal() (buf []byte, err error)

func (*Schema) MustGetExtraBytes added in v0.8.0

func (s *Schema) MustGetExtraBytes() []byte

func (*Schema) MustRestoreExtra added in v0.8.0

func (s *Schema) MustRestoreExtra(data []byte)

func (*Schema) ReadFromBatch added in v0.6.0

func (s *Schema) ReadFromBatch(bat *containers.Batch, offset int, targetTid uint64) (next int)

func (*Schema) ReadFromWithVersion added in v1.0.0

func (s *Schema) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

func (*Schema) String

func (s *Schema) String() string

func (*Schema) Types

func (s *Schema) Types() []types.Type

type SortKey

type SortKey struct {
	Defs []*ColDef
	// contains filtered or unexported fields
}

func NewSortKey

func NewSortKey() *SortKey

func (*SortKey) AddDef

func (cpk *SortKey) AddDef(def *ColDef) (ok bool)

func (*SortKey) GetDef

func (cpk *SortKey) GetDef(pos int) *ColDef

func (*SortKey) GetSingleIdx

func (cpk *SortKey) GetSingleIdx() int

func (*SortKey) HasColumn

func (cpk *SortKey) HasColumn(idx int) (found bool)

func (*SortKey) IsPrimary

func (cpk *SortKey) IsPrimary() bool

func (*SortKey) Size

func (cpk *SortKey) Size() int

type TableDataFactory

type TableDataFactory = func(meta *TableEntry) data.Table
var DefaultTableDataFactory TableDataFactory

type TableEntry

type TableEntry struct {
	*BaseEntryImpl[*TableMVCCNode]
	*TableNode
	Stats *common.TableCompactStat
	ID    uint64

	// used for the next flush table tail.
	DeletedDirties []*ObjectEntry
	// 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,
	state EntryState,
	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) (deleted *ObjectEntry, err error)

func (*TableEntry) FreezeAppend added in v0.8.0

func (entry *TableEntry) FreezeAppend()

func (*TableEntry) GCTombstone added in v1.2.0

func (entry *TableEntry) GCTombstone(id objectio.ObjectId)

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) GetDeleteList added in v1.2.0

func (entry *TableEntry) GetDeleteList() *btree.BTreeG[DeleteEntry]

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() *Schema

GetLastestSchema returns the latest committed schema with entry locked

func (*TableEntry) GetLastestSchemaLocked added in v1.2.0

func (entry *TableEntry) GetLastestSchemaLocked() *Schema

GetLastestSchemaLocked returns the latest committed schema with entry Not locked

func (*TableEntry) GetObjectByID added in v1.1.0

func (entry *TableEntry) GetObjectByID(id *types.Objectid) (obj *ObjectEntry, err error)

func (*TableEntry) GetObjectsByID added in v1.1.0

func (entry *TableEntry) GetObjectsByID(id *types.Segmentid) (obj []*ObjectEntry, err error)

func (*TableEntry) GetOrCreateTombstone added in v1.2.0

func (entry *TableEntry) GetOrCreateTombstone(obj *ObjectEntry, factory TombstoneFactory) data.Tombstone

func (*TableEntry) GetRows

func (entry *TableEntry) GetRows() uint64

func (*TableEntry) GetTableData

func (entry *TableEntry) GetTableData() data.Table

func (*TableEntry) GetTerminationTS added in v0.6.0

func (entry *TableEntry) GetTerminationTS() (ts types.TS, terminated bool)

GetTerminationTS is coarse API: no consistency check

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) *Schema

GetVisibleSchema returns committed schema visible at the given txn

func (*TableEntry) Is1PC added in v0.6.0

func (entry *TableEntry) Is1PC() bool

func (*TableEntry) IsActive

func (entry *TableEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*TableEntry) IsVirtual

func (entry *TableEntry) IsVirtual() bool

func (*TableEntry) LastAppendableObject added in v1.1.0

func (entry *TableEntry) LastAppendableObject() (obj *ObjectEntry)

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) MakeObjectIt added in v1.1.0

func (entry *TableEntry) MakeObjectIt(reverse bool) *common.GenericSortedDListIt[*ObjectEntry]

func (*TableEntry) ObjectStats added in v1.0.2

func (entry *TableEntry) ObjectStats(level common.PPLevel, start, end int) (stat TableStat, w bytes.Buffer)

func (*TableEntry) ObjectStatsString added in v1.0.0

func (entry *TableEntry) ObjectStatsString(level common.PPLevel, start, end int) string

func (*TableEntry) PPString

func (entry *TableEntry) PPString(level common.PPLevel, depth int, prefix string) string

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) Set1PC added in v0.6.0

func (entry *TableEntry) Set1PC()

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) TryGetTombstone added in v1.2.0

func (entry *TableEntry) TryGetTombstone(oid objectio.ObjectId) data.Tombstone

type TableMVCCNode added in v0.6.0

type TableMVCCNode struct {
	// history schema
	Schema *Schema
}

func NewEmptyTableMVCCNode added in v0.6.0

func NewEmptyTableMVCCNode() *TableMVCCNode

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) IdempotentUpdate added in v1.1.1

func (e *TableMVCCNode) IdempotentUpdate(un *TableMVCCNode)

func (*TableMVCCNode) ReadFromWithVersion added in v1.0.0

func (e *TableMVCCNode) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

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

func (*TableMVCCNode) WriteTo added in v0.6.0

func (e *TableMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type TableNode added in v0.8.0

type TableNode struct {
	// contains filtered or unexported fields
}

func (*TableNode) ReadFrom added in v0.8.0

func (node *TableNode) ReadFrom(r io.Reader) (n int64, err error)

func (*TableNode) WriteTo added in v0.8.0

func (node *TableNode) WriteTo(w io.Writer) (n int64, err error)

type TableStat added in v1.0.2

type TableStat struct {
	ObjectCnt int
	Loaded    int
	Rows      int
	OSize     int
	Csize     int
}

type TombstoneFactory added in v1.2.0

type TombstoneFactory = func(meta *ObjectEntry) data.Tombstone

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL