Documentation ¶
Index ¶
- Constants
- Variables
- func BuildCommandFrom(buf []byte) (cmd any, err error)
- func CompareTxnMVCCNode(e, o *TxnMVCCNode) int
- func IDCtxToID(buf []byte) string
- func IDToIDCtx(id uint64) []byte
- func MarshalID(id *common.ID) []byte
- func TxnField(txn txnif.AsyncTxn) zap.Field
- func TxnMgrField(mgr *TxnManager) zap.Field
- func UnmarshalID(buf []byte) *common.ID
- type BaseCmd
- type BaseCustomizedCmd
- type ComposedCmd
- func (cc *ComposedCmd) AddCmd(cmd txnif.TxnCmd)
- func (cc *ComposedCmd) ApplyCommit()
- func (cc *ComposedCmd) ApplyRollback()
- func (cc *ComposedCmd) Close()
- func (cc *ComposedCmd) Desc() string
- func (cc *ComposedCmd) GetType() uint16
- func (cc *ComposedCmd) MarshalBinary() (buf []byte, err error)
- func (cc *ComposedCmd) MoreCmds() bool
- func (cc *ComposedCmd) SetReplayTxn(txn txnif.AsyncTxn)
- func (cc *ComposedCmd) String() string
- func (cc *ComposedCmd) ToDesc(prefix string) string
- func (cc *ComposedCmd) ToString(prefix string) string
- func (cc *ComposedCmd) ToVerboseString(prefix string) string
- func (cc *ComposedCmd) UnmarshalBinary(buf []byte) (err error)
- func (cc *ComposedCmd) VerboseString() string
- func (cc *ComposedCmd) WriteTo(w io.Writer) (n int64, err error)
- type MVCCChain
- func (be *MVCCChain[T]) Apply1PCCommit() error
- func (be *MVCCChain[T]) ApplyCommit() error
- func (be *MVCCChain[T]) ApplyRollback() error
- func (be *MVCCChain[T]) CheckConflict(txn txnif.TxnReader) (err error)
- func (be *MVCCChain[T]) CloneCommittedInRange(start, end types.TS) (ret *MVCCChain[T])
- func (be *MVCCChain[T]) CloneLatestNode() (*MVCCChain[T], T)
- func (be *MVCCChain[T]) ClonePreparedInRange(start, end types.TS) (ret []T)
- func (be *MVCCChain[T]) Depth() int
- func (be *MVCCChain[T]) GetLatestCommittedNode() (node T)
- func (be *MVCCChain[T]) GetLatestNodeLocked() T
- func (be *MVCCChain[T]) GetPrepareTs() types.TS
- func (be *MVCCChain[T]) GetTxn() txnif.TxnReader
- func (be *MVCCChain[T]) GetVisibleNode(txn txnif.TxnReader) (node T)
- func (be *MVCCChain[T]) GetVisibleNodeByTS(ts types.TS) (node T)
- func (be *MVCCChain[T]) HasCommittedNode() bool
- func (be *MVCCChain[T]) HasCommittedNodeInRange(start, end types.TS) (ok bool)
- func (be *MVCCChain[T]) HasUncommittedNode() bool
- func (be *MVCCChain[T]) Insert(vun T) (node *common.GenericDLNode[T])
- func (be *MVCCChain[T]) IsCommitted() bool
- func (be *MVCCChain[T]) IsCommitting() bool
- func (be *MVCCChain[T]) IsCreatingOrAborted() bool
- func (be *MVCCChain[T]) IsEmpty() bool
- func (be *MVCCChain[T]) LoopChain(fn func(T) bool)
- func (be *MVCCChain[T]) MustOneNodeLocked() (T, bool)
- func (be *MVCCChain[T]) NeedWaitCommitting(ts types.TS) (bool, txnif.TxnReader)
- func (be *MVCCChain[T]) PrepareCommit() error
- func (be *MVCCChain[T]) PrepareRollback() (bool, error)
- func (be *MVCCChain[T]) ReadAllFrom(r io.Reader) (n int64, err error)
- func (be *MVCCChain[T]) ReadOneNodeFrom(r io.Reader) (n int64, err error)
- func (be *MVCCChain[T]) SearchNode(o T) (node T)
- func (be *MVCCChain[T]) StringLocked() string
- func (be *MVCCChain[T]) WriteAllTo(w io.Writer) (n int64, err error)
- func (be *MVCCChain[T]) WriteOneNodeTo(w io.Writer) (n int64, err error)
- type MVCCSlice
- func (be *MVCCSlice[T]) DeleteNode(node T)
- func (be *MVCCSlice[T]) ForEach(fn func(un T) bool, reverse bool)
- func (be *MVCCSlice[T]) GetCommittedNode() (node T)
- func (be *MVCCSlice[T]) GetLastNonAbortedNode() (node T)
- func (be *MVCCSlice[T]) GetNodeByOffset(offset int) T
- func (be *MVCCSlice[T]) GetNodeToReadByPrepareTS(ts types.TS) (offset int, node T)
- func (be *MVCCSlice[T]) GetTs() types.TS
- func (be *MVCCSlice[T]) GetUpdateNodeLocked() T
- func (be *MVCCSlice[T]) InsertNode(un T)
- func (be *MVCCSlice[T]) IsCommitted() bool
- func (be *MVCCSlice[T]) IsCommitting() bool
- func (be *MVCCSlice[T]) IsEmpty() bool
- func (be *MVCCSlice[T]) LoopInRange(start, end types.TS, fn func(T) bool)
- func (be *MVCCSlice[T]) LoopOffsetRange(start, end int, fn func(T) bool)
- func (be *MVCCSlice[T]) SearchNode(o T) (node T)
- func (be *MVCCSlice[T]) SearchNodeByCompareFn(fn func(a T) int) (offset int, node T)
- func (be *MVCCSlice[T]) SearchNodeByTS(ts types.TS) (node T)
- func (be *MVCCSlice[T]) StringLocked() string
- type NoopCommitListener
- type NoopTxnStore
- func (store *NoopTxnStore) AddBlksWithMetaLoc(ctx context.Context, dbId, tid uint64, metaLocs []objectio.Location) error
- func (store *NoopTxnStore) AddTxnEntry(t txnif.TxnEntryType, entry txnif.TxnEntry)
- func (store *NoopTxnStore) AddWaitEvent(cnt int)
- func (store *NoopTxnStore) Append(ctx context.Context, dbId, id uint64, data *containers.Batch) error
- func (store *NoopTxnStore) Apply2PCPrepare() error
- func (store *NoopTxnStore) ApplyCommit() error
- func (store *NoopTxnStore) ApplyRollback() error
- func (store *NoopTxnStore) BatchDedup(uint64, uint64, containers.Vector) (err error)
- func (store *NoopTxnStore) BindTxn(txn txnif.AsyncTxn)
- func (store *NoopTxnStore) Close() error
- func (store *NoopTxnStore) CreateBlock(*common.ID, bool) (blk handle.Block, err error)
- func (store *NoopTxnStore) CreateDatabase(name, creatSql, datTyp string) (db handle.Database, err error)
- func (store *NoopTxnStore) CreateDatabaseWithID(name, createSql, datTyp string, id uint64) (db handle.Database, err error)
- func (store *NoopTxnStore) CreateNonAppendableBlock(*common.ID, *objectio.CreateBlockOpt) (blk handle.Block, err error)
- func (store *NoopTxnStore) CreateNonAppendableSegment(dbId, tid uint64, _ bool) (seg handle.Segment, err error)
- func (store *NoopTxnStore) CreateRelation(dbId uint64, def any) (rel handle.Relation, err error)
- func (store *NoopTxnStore) CreateRelationWithTableId(dbId uint64, tableId uint64, def any) (rel handle.Relation, err error)
- func (store *NoopTxnStore) CreateSegment(dbId, tid uint64, is1PC bool) (seg handle.Segment, err error)
- func (store *NoopTxnStore) DatabaseNames() (names []string)
- func (store *NoopTxnStore) DoneWaitEvent(cnt int)
- func (store *NoopTxnStore) DropDatabase(name string) (db handle.Database, err error)
- func (store *NoopTxnStore) DropDatabaseByID(id uint64) (db handle.Database, err error)
- func (store *NoopTxnStore) DropRelationByID(dbId uint64, id uint64) (rel handle.Relation, err error)
- func (store *NoopTxnStore) DropRelationByName(dbId uint64, name string) (rel handle.Relation, err error)
- func (store *NoopTxnStore) Freeze() error
- func (store *NoopTxnStore) GetBlock(id *common.ID) (blk handle.Block, err error)
- func (store *NoopTxnStore) GetByFilter(context.Context, uint64, uint64, *handle.Filter) (id *common.ID, offset uint32, err error)
- func (store *NoopTxnStore) GetContext() context.Context
- func (store *NoopTxnStore) GetDatabase(name string) (db handle.Database, err error)
- func (store *NoopTxnStore) GetDatabaseByID(id uint64) (db handle.Database, err error)
- func (store *NoopTxnStore) GetDirty() *model.Tree
- func (store *NoopTxnStore) GetDirtyTableByID(id uint64) *model.TableTree
- func (store *NoopTxnStore) GetLSN() uint64
- func (store *NoopTxnStore) GetRelationByID(dbId uint64, id uint64) (rel handle.Relation, err error)
- func (store *NoopTxnStore) GetRelationByName(dbId uint64, name string) (rel handle.Relation, err error)
- func (store *NoopTxnStore) GetSegment(id *common.ID) (seg handle.Segment, err error)
- func (store *NoopTxnStore) GetTransactionType() txnif.TxnType
- func (store *NoopTxnStore) GetValue(*common.ID, uint32, uint16) (v any, isNull bool, err error)
- func (store *NoopTxnStore) HasAnyTableDataChanges() bool
- func (store *NoopTxnStore) HasCatalogChanges() bool
- func (store *NoopTxnStore) HasTableDataChanges(id uint64) bool
- func (store *NoopTxnStore) IncreateWriteCnt() int
- func (store *NoopTxnStore) IsReadonly() bool
- func (store *NoopTxnStore) LogTxnEntry(dbId, tableId uint64, entry txnif.TxnEntry, readed []*common.ID) (err error)
- func (store *NoopTxnStore) LogTxnState(sync bool) (logEntry entry.Entry, err error)
- func (store *NoopTxnStore) ObserveTxn(visitDatabase func(db any), visitTable func(tbl any), ...)
- func (store *NoopTxnStore) PreApplyCommit() error
- func (store *NoopTxnStore) PrePrepare(ctx context.Context) error
- func (store *NoopTxnStore) PrepareCommit() error
- func (store *NoopTxnStore) PrepareRollback() error
- func (store *NoopTxnStore) PrepareWAL() error
- func (store *NoopTxnStore) RangeDelete(*common.ID, uint32, uint32, handle.DeleteType) (err error)
- func (store *NoopTxnStore) SoftDeleteBlock(id *common.ID) (err error)
- func (store *NoopTxnStore) SoftDeleteSegment(id *common.ID) (err error)
- func (store *NoopTxnStore) UnsafeGetDatabase(id uint64) (db handle.Database, err error)
- func (store *NoopTxnStore) UnsafeGetRelation(dbId, id uint64) (rel handle.Relation, err error)
- func (store *NoopTxnStore) Update(uint64, *common.ID, uint32, uint16, any) (err error)
- func (store *NoopTxnStore) UpdateDeltaLoc(id *common.ID, un objectio.Location) (err error)
- func (store *NoopTxnStore) UpdateMetaLoc(id *common.ID, un objectio.Location) (err error)
- func (store *NoopTxnStore) WaitPrepared(ctx context.Context) (err error)
- type OpTxn
- type OpType
- type Txn
- func (txn *Txn) ApplyCommit() (err error)
- func (txn *Txn) ApplyRollback() (err error)
- func (txn *Txn) BindAccessInfo(tenantID, userID, roleID uint32)
- func (txn *Txn) Commit(ctx context.Context) (err error)
- func (txn *Txn) CommitInRecovery(ctx context.Context) (err error)
- func (txn *Txn) Committing() (err error)
- func (txn *Txn) CommittingInRecovery() (err error)
- func (txn *Txn) CreateDatabase(name, createSql, datTyp string) (db handle.Database, err error)
- func (txn *Txn) CreateDatabaseWithCtx(ctx context.Context, name, createSql, datTyp string, id uint64) (db handle.Database, err error)
- func (txn *Txn) CurrentDatabase() (db handle.Database)
- func (txn *Txn) DatabaseNames() (names []string)
- func (txn *Txn) DoneWithErr(err error, isAbort bool)
- func (txn *Txn) DropDatabase(name string) (db handle.Database, err error)
- func (txn *Txn) DropDatabaseByID(id uint64) (db handle.Database, err error)
- func (txn *Txn) Freeze() error
- func (txn *Txn) GetContext() context.Context
- func (txn *Txn) GetDatabase(name string) (db handle.Database, err error)
- func (txn *Txn) GetDatabaseByID(id uint64) (db handle.Database, err error)
- func (txn *Txn) GetDatabaseWithCtx(_ context.Context, _ string) (db handle.Database, err error)
- func (txn *Txn) GetDedupType() txnif.DedupType
- func (txn *Txn) GetError() error
- func (txn *Txn) GetLSN() uint64
- func (txn *Txn) GetLsn() uint64
- func (txn *Txn) GetStore() txnif.TxnStore
- func (txn *Txn) GetTenantID() uint32
- func (txn *Txn) GetUserAndRoleID() (uint32, uint32)
- func (txn *Txn) IsReplay() bool
- func (txn *Txn) LogTxnEntry(dbId, tableId uint64, entry txnif.TxnEntry, readed []*common.ID) (err error)
- func (txn *Txn) LogTxnState(sync bool) (logEntry entry.Entry, err error)
- func (txn *Txn) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
- func (txn *Txn) MockIncWriteCnt() int
- func (txn *Txn) PreApplyCommit() (err error)
- func (txn *Txn) PrePrepare(ctx context.Context) error
- func (txn *Txn) Prepare(ctx context.Context) (pts types.TS, err error)
- func (txn *Txn) PrepareCommit() (err error)
- func (txn *Txn) PrepareRollback() (err error)
- func (txn *Txn) PrepareWAL() (err error)
- func (txn *Txn) Rollback(ctx context.Context) (err error)
- func (txn *Txn) SetApplyCommitFn(fn func(txnif.AsyncTxn) error)
- func (txn *Txn) SetApplyRollbackFn(fn func(txnif.AsyncTxn) error)
- func (txn *Txn) SetDedupType(dedupType txnif.DedupType)
- func (txn *Txn) SetError(err error)
- func (txn *Txn) SetPrepareCommitFn(fn func(txnif.AsyncTxn) error)
- func (txn *Txn) SetPrepareRollbackFn(fn func(txnif.AsyncTxn) error)
- func (txn *Txn) String() string
- func (txn *Txn) UnsafeGetDatabase(id uint64) (db handle.Database, err error)
- func (txn *Txn) UnsafeGetRelation(dbId, id uint64) (db handle.Relation, err error)
- func (txn *Txn) UseDatabase(name string) (err error)
- func (txn *Txn) WaitDone(err error, isAbort bool) error
- func (txn *Txn) WaitPrepared(ctx context.Context) error
- type TxnBlock
- func (blk *TxnBlock) Append(*containers.Batch, uint32) (n uint32, err error)
- func (blk *TxnBlock) Close() error
- func (blk *TxnBlock) Fingerprint() *common.ID
- func (blk *TxnBlock) GetByFilter(*handle.Filter) (offset uint32, err error)
- func (blk *TxnBlock) GetMeta() any
- func (blk *TxnBlock) GetSegment() (seg handle.Segment)
- func (blk *TxnBlock) GetTotalChanges() int
- func (blk *TxnBlock) ID() uint64
- func (blk *TxnBlock) IsAppendableBlock() bool
- func (blk *TxnBlock) PushDeleteOp(handle.Filter) (err error)
- func (blk *TxnBlock) PushUpdateOp(handle.Filter, string, any) (err error)
- func (blk *TxnBlock) RangeDelete(uint32, uint32, handle.DeleteType) (err error)
- func (blk *TxnBlock) Reset()
- func (blk *TxnBlock) Rows() int
- func (blk *TxnBlock) String() string
- func (blk *TxnBlock) Update(uint32, uint16, any) (err error)
- type TxnCmd
- func (c *TxnCmd) ApplyCommit()
- func (c *TxnCmd) ApplyRollback()
- func (c *TxnCmd) Close()
- func (c *TxnCmd) Desc() string
- func (c *TxnCmd) GetType() uint16
- func (c *TxnCmd) IsLastCmd() bool
- func (c *TxnCmd) MarshalBinary() (buf []byte, err error)
- func (c *TxnCmd) ReadFrom(r io.Reader) (n int64, err error)
- func (c *TxnCmd) SetReplayTxn(txn txnif.AsyncTxn)
- func (c *TxnCmd) SetTxn(txn txnif.AsyncTxn)
- func (c *TxnCmd) String() string
- func (c *TxnCmd) UnmarshalBinary(buf []byte) (err error)
- func (c *TxnCmd) VerboseString() string
- func (c *TxnCmd) WriteTo(w io.Writer) (n int64, err error)
- type TxnCommitListener
- type TxnCtx
- func (ctx *TxnCtx) CommitAfter(startTs types.TS) bool
- func (ctx *TxnCtx) CommitBefore(startTs types.TS) bool
- func (ctx *TxnCtx) GetCommitTS() types.TS
- func (ctx *TxnCtx) GetCtx() []byte
- func (ctx *TxnCtx) GetID() string
- func (ctx *TxnCtx) GetMemo() *txnif.TxnMemo
- func (ctx *TxnCtx) GetParticipants() []uint64
- func (ctx *TxnCtx) GetPrepareTS() types.TS
- func (ctx *TxnCtx) GetSnapshotTS() types.TS
- func (ctx *TxnCtx) GetStartTS() types.TS
- func (ctx *TxnCtx) GetTxnState(waitIfCommitting bool) (state txnif.TxnState)
- func (ctx *TxnCtx) HasSnapshotLag() bool
- func (ctx *TxnCtx) Is2PC() bool
- func (ctx *TxnCtx) IsActiveLocked() bool
- func (ctx *TxnCtx) IsReplay() bool
- func (ctx *TxnCtx) IsVisible(o txnif.TxnReader) bool
- func (ctx *TxnCtx) MockStartTS(ts types.TS)
- func (ctx *TxnCtx) Repr() string
- func (ctx *TxnCtx) SameTxn(txn txnif.TxnReader) bool
- func (ctx *TxnCtx) SetCommitTS(cts types.TS) (err error)
- func (ctx *TxnCtx) SetParticipants(ids []uint64) (err error)
- func (ctx *TxnCtx) SetSnapshotTS(ts types.TS)
- func (ctx *TxnCtx) String() string
- func (ctx *TxnCtx) ToCommittedLocked() error
- func (ctx *TxnCtx) ToCommittingFinished() (err error)
- func (ctx *TxnCtx) ToCommittingFinishedLocked() (err error)
- func (ctx *TxnCtx) ToPrepared() (err error)
- func (ctx *TxnCtx) ToPreparedLocked() (err error)
- func (ctx *TxnCtx) ToPreparingLocked(ts types.TS) error
- func (ctx *TxnCtx) ToRollbackedLocked() error
- func (ctx *TxnCtx) ToRollbacking(ts types.TS) error
- func (ctx *TxnCtx) ToRollbackingLocked(ts types.TS) error
- func (ctx *TxnCtx) ToUnknownLocked()
- type TxnDatabase
- func (db *TxnDatabase) Close() error
- func (db *TxnDatabase) CreateRelation(def any) (rel handle.Relation, err error)
- func (db *TxnDatabase) DropRelationByName(name string) (rel handle.Relation, err error)
- func (db *TxnDatabase) GetID() uint64
- func (db *TxnDatabase) GetMeta() any
- func (db *TxnDatabase) GetName() string
- func (db *TxnDatabase) GetRelationByName(name string) (rel handle.Relation, err error)
- func (db *TxnDatabase) MakeRelationIt() (it handle.RelationIt)
- func (db *TxnDatabase) RelationCnt() int64
- func (db *TxnDatabase) Relations() (rels []handle.Relation)
- func (db *TxnDatabase) String() string
- func (db *TxnDatabase) UnsafeGetRelation(id uint64) (rel handle.Relation, err error)
- type TxnFactory
- type TxnMVCCNode
- func (un *TxnMVCCNode) AppendTuple(bat *containers.Batch)
- func (un *TxnMVCCNode) ApplyCommit() (ts types.TS, err error)
- func (un *TxnMVCCNode) ApplyRollback() (ts types.TS, err error)
- func (un *TxnMVCCNode) CheckConflict(txn txnif.TxnReader) error
- func (un *TxnMVCCNode) CloneAll() *TxnMVCCNode
- func (un *TxnMVCCNode) CommittedIn(minTS, maxTS types.TS) (in, before bool)
- func (un *TxnMVCCNode) Compare(o *TxnMVCCNode) int
- func (un *TxnMVCCNode) Compare2(o *TxnMVCCNode) int
- func (un *TxnMVCCNode) GetEnd() types.TS
- func (un *TxnMVCCNode) GetPrepare() types.TS
- func (un *TxnMVCCNode) GetStart() types.TS
- func (un *TxnMVCCNode) GetTxn() txnif.TxnReader
- func (un *TxnMVCCNode) Is1PC() bool
- func (un *TxnMVCCNode) IsAborted() bool
- func (un *TxnMVCCNode) IsActive() bool
- func (un *TxnMVCCNode) IsCommitted() bool
- func (un *TxnMVCCNode) IsCommitting() bool
- func (un *TxnMVCCNode) IsSameTxn(txn txnif.TxnReader) bool
- func (un *TxnMVCCNode) IsVisible(txn txnif.TxnReader) (visible bool)
- func (un *TxnMVCCNode) IsVisibleByTS(ts types.TS) (visible bool)
- func (un *TxnMVCCNode) NeedWaitCommitting(ts types.TS) (bool, txnif.TxnReader)
- func (un *TxnMVCCNode) PrepareCommit() (ts types.TS, err error)
- func (un *TxnMVCCNode) PrepareRollback() (err error)
- func (un *TxnMVCCNode) PreparedIn(minTS, maxTS types.TS) (in, before bool)
- func (un *TxnMVCCNode) ReadFrom(r io.Reader) (n int64, err error)
- func (un *TxnMVCCNode) ReadTuple(bat *containers.Batch, offset int)
- func (un *TxnMVCCNode) Set1PC()
- func (un *TxnMVCCNode) String() string
- func (un *TxnMVCCNode) Update(o *TxnMVCCNode)
- func (un *TxnMVCCNode) WriteTo(w io.Writer) (n int64, err error)
- type TxnManager
- func (mgr *TxnManager) DeleteTxn(id string) (err error)
- func (mgr *TxnManager) EnqueueFlushing(op any) (err error)
- func (mgr *TxnManager) GetOrCreateTxnWithMeta(info []byte, id []byte, ts types.TS) (txn txnif.AsyncTxn, err error)
- func (mgr *TxnManager) GetTxn(id string) txnif.AsyncTxn
- func (mgr *TxnManager) GetTxnByCtx(ctx []byte) txnif.AsyncTxn
- func (mgr *TxnManager) Init(prevTs types.TS) error
- func (mgr *TxnManager) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
- func (mgr *TxnManager) MinTSForTest() types.TS
- func (mgr *TxnManager) Now() types.TS
- func (mgr *TxnManager) OnCommitTxn(txn txnif.AsyncTxn)
- func (mgr *TxnManager) OnException(new error)
- func (mgr *TxnManager) OnOpTxn(op *OpTxn) (err error)
- func (mgr *TxnManager) OnReplayTxn(txn txnif.AsyncTxn) (err error)
- func (mgr *TxnManager) Start(ctx context.Context)
- func (mgr *TxnManager) StartTxn(info []byte) (txn txnif.AsyncTxn, err error)
- func (mgr *TxnManager) StartTxnWithLatestTS(info []byte) (txn txnif.AsyncTxn, err error)
- func (mgr *TxnManager) StatMaxCommitTS() (ts types.TS)
- func (mgr *TxnManager) Stop()
- type TxnRelation
- func (rel *TxnRelation) AddBlksWithMetaLoc(context.Context, []objectio.Location) error
- func (rel *TxnRelation) AlterTable(context.Context, *apipb.AlterTableReq) (err error)
- func (rel *TxnRelation) Append(ctx context.Context, data *containers.Batch) error
- func (rel *TxnRelation) BatchDedup(col containers.Vector) error
- func (rel *TxnRelation) Close() error
- func (rel *TxnRelation) CreateNonAppendableSegment(bool) (seg handle.Segment, err error)
- func (rel *TxnRelation) CreateSegment(bool) (seg handle.Segment, err error)
- func (rel *TxnRelation) DeleteByFilter(ctx context.Context, filter *handle.Filter) (err error)
- func (rel *TxnRelation) DeleteByPhyAddrKey(any) (err error)
- func (rel *TxnRelation) DeleteByPhyAddrKeys(containers.Vector) (err error)
- func (rel *TxnRelation) GetByFilter(context.Context, *handle.Filter) (id *common.ID, offset uint32, err error)
- func (rel *TxnRelation) GetCardinality(attr string) int64
- func (rel *TxnRelation) GetDB() (handle.Database, error)
- func (rel *TxnRelation) GetMeta() any
- func (rel *TxnRelation) GetSegment(id *types.Segmentid) (seg handle.Segment, err error)
- func (rel *TxnRelation) GetValue(*common.ID, uint32, uint16) (v any, isNull bool, err error)
- func (rel *TxnRelation) GetValueByFilter(ctx context.Context, filter *handle.Filter, col int) (v any, isNull bool, err error)
- func (rel *TxnRelation) GetValueByPhyAddrKey(any, int) (v any, isNull bool, err error)
- func (rel *TxnRelation) ID() uint64
- func (rel *TxnRelation) LogTxnEntry(entry txnif.TxnEntry, readed []*common.ID) (err error)
- func (rel *TxnRelation) MakeBlockIt() handle.BlockIt
- func (rel *TxnRelation) MakeSegmentIt() handle.SegmentIt
- func (rel *TxnRelation) MakeSegmentItOnSnap() handle.SegmentIt
- func (rel *TxnRelation) RangeDelete(*common.ID, uint32, uint32, handle.DeleteType) (err error)
- func (rel *TxnRelation) Rows() int64
- func (rel *TxnRelation) Schema() any
- func (rel *TxnRelation) SimplePPString(_ common.PPLevel) string
- func (rel *TxnRelation) Size(attr string) int64
- func (rel *TxnRelation) SoftDeleteSegment(id *types.Segmentid) (err error)
- func (rel *TxnRelation) String() string
- func (rel *TxnRelation) Update(*common.ID, uint32, uint16, any, bool) (err error)
- func (rel *TxnRelation) UpdateByFilter(ctx context.Context, filter *handle.Filter, col uint16, v any, isNull bool) (err error)
- type TxnSegment
- func (seg *TxnSegment) BatchDedup(containers.Vector) (err error)
- func (seg *TxnSegment) Close() error
- func (seg *TxnSegment) CreateBlock() (blk handle.Block, err error)
- func (seg *TxnSegment) CreateNonAppendableBlock() (blk handle.Block, err error)
- func (seg *TxnSegment) GetBlock(id uint64) (blk handle.Block, err error)
- func (seg *TxnSegment) GetID() uint64
- func (seg *TxnSegment) GetMeta() any
- func (seg *TxnSegment) GetRelation() (rel handle.Relation)
- func (seg *TxnSegment) MakeBlockIt() (it handle.BlockIt)
- func (seg *TxnSegment) PushDeleteOp(handle.Filter) (err error)
- func (seg *TxnSegment) PushUpdateOp(handle.Filter, string, any) (err error)
- func (seg *TxnSegment) RangeDelete(uint64, uint32, uint32, handle.DeleteType) (err error)
- func (seg *TxnSegment) Reset()
- func (seg *TxnSegment) SoftDeleteBlock(id types.Blockid) (err error)
- func (seg *TxnSegment) String() string
- func (seg *TxnSegment) Update(uint64, uint32, uint16, any) (err error)
- type TxnState
- type TxnStateCmd
- func (c *TxnStateCmd) ApplyCommit()
- func (c *TxnStateCmd) ApplyRollback()
- func (c *TxnStateCmd) Close()
- func (c *TxnStateCmd) Desc() string
- func (c *TxnStateCmd) GetType() uint16
- func (c *TxnStateCmd) MarshalBinary() (buf []byte, err error)
- func (c *TxnStateCmd) ReadFrom(r io.Reader) (n int64, err error)
- func (c *TxnStateCmd) SetReplayTxn(_ txnif.AsyncTxn)
- func (c *TxnStateCmd) String() string
- func (c *TxnStateCmd) UnmarshalBinary(buf []byte) (err error)
- func (c *TxnStateCmd) VerboseString() string
- func (c *TxnStateCmd) WriteTo(w io.Writer) (n int64, err error)
- type TxnStoreFactory
Constants ¶
const ( IOET_WALTxnEntry uint16 = 3000 IOET_WALTxnCommand_Composed uint16 = 3001 IOET_WALTxnCommand_TxnState uint16 = 3002 IOET_WALTxnEntry_V1 uint16 = 1 IOET_WALTxnCommand_Composed_V1 uint16 = 1 IOET_WALTxnCommand_TxnState_V1 uint16 = 1 IOET_WALTxnEntry_CurrVer = IOET_WALTxnEntry_V1 IOET_WALTxnCommand_Composed_CurrVer = IOET_WALTxnCommand_Composed_V1 IOET_WALTxnCommand_TxnState_CurrVer = IOET_WALTxnCommand_TxnState_V1 // CmdBufReserved is reserved size of cmd buffer. ComposedCmd.CmdBufLimit is // the max buffer size that could be sent out to log-service. This value is normally // the max RPC message size which is configured in config of DN. The message contains // mainly commands, but also other information whose size is CmdBufReserved. CmdBufReserved = 1024 )
const ( TSUncommitted int32 = iota TSCommitting TSCommitted TSRollbacking TSRollbacked )
const ( OpCommit = iota OpRollback OpPrepare OpCommitting OpInvalid )
const ( EventRollback = iota + 1 EventCommitting EventCommit )
const (
IDSize = 8 + types.UuidSize + types.BlockidSize + 4 + 2 + 1
)
Variables ¶
var ( SnapshotAttr_StartTS = "start_ts" SnapshotAttr_PrepareTS = "prepare_ts" SnapshotAttr_CommitTS = "commit_ts" SnapshotAttr_LogIndex_LSN = "log_index_lsn" SnapshotAttr_LogIndex_CSN = "log_index_csn" SnapshotAttr_LogIndex_Size = "log_index_size" )
var DefaultTxnFactory = func( mgr *TxnManager, store txnif.TxnStore, id []byte, startTS types.TS, snapshotTS types.TS) txnif.AsyncTxn { return NewTxn(mgr, store, id, startTS, snapshotTS) }
var (
ErrTransferTransactionState = moerr.NewInternalErrorNoCtx("tae: transfer transaction state error")
)
var NoopStoreFactory = func() txnif.TxnStore { return new(NoopTxnStore) }
Functions ¶
func BuildCommandFrom ¶
func CompareTxnMVCCNode ¶ added in v0.6.0
func CompareTxnMVCCNode(e, o *TxnMVCCNode) int
func TxnMgrField ¶
func TxnMgrField(mgr *TxnManager) zap.Field
func UnmarshalID ¶
Types ¶
type BaseCustomizedCmd ¶
func NewBaseCustomizedCmd ¶
func NewBaseCustomizedCmd(id uint32, impl txnif.TxnCmd) *BaseCustomizedCmd
func (*BaseCustomizedCmd) GetID ¶
func (c *BaseCustomizedCmd) GetID() uint32
type ComposedCmd ¶
type ComposedCmd struct { Cmds []txnif.TxnCmd // CmdBufLimit indicates max cmd buffer size. We can only send out // the cmd buffer whose size is less than it. CmdBufLimit int64 // lastPos is the position in the Cmds list, before which the cmds have // been marshalled into buffer. LastPos int }
func NewComposedCmd ¶
func NewComposedCmd(maxSize uint64) *ComposedCmd
func (*ComposedCmd) AddCmd ¶
func (cc *ComposedCmd) AddCmd(cmd txnif.TxnCmd)
func (*ComposedCmd) ApplyCommit ¶ added in v0.6.0
func (cc *ComposedCmd) ApplyCommit()
func (*ComposedCmd) ApplyRollback ¶ added in v0.6.0
func (cc *ComposedCmd) ApplyRollback()
func (*ComposedCmd) Close ¶
func (cc *ComposedCmd) Close()
func (*ComposedCmd) Desc ¶
func (cc *ComposedCmd) Desc() string
func (*ComposedCmd) GetType ¶
func (cc *ComposedCmd) GetType() uint16
func (*ComposedCmd) MarshalBinary ¶ added in v0.8.0
func (cc *ComposedCmd) MarshalBinary() (buf []byte, err error)
func (*ComposedCmd) MoreCmds ¶ added in v0.8.0
func (cc *ComposedCmd) MoreCmds() bool
func (*ComposedCmd) SetReplayTxn ¶ added in v0.6.0
func (cc *ComposedCmd) SetReplayTxn(txn txnif.AsyncTxn)
func (*ComposedCmd) String ¶
func (cc *ComposedCmd) String() string
func (*ComposedCmd) ToDesc ¶
func (cc *ComposedCmd) ToDesc(prefix string) string
func (*ComposedCmd) ToString ¶
func (cc *ComposedCmd) ToString(prefix string) string
func (*ComposedCmd) ToVerboseString ¶
func (cc *ComposedCmd) ToVerboseString(prefix string) string
func (*ComposedCmd) UnmarshalBinary ¶ added in v0.8.0
func (cc *ComposedCmd) UnmarshalBinary(buf []byte) (err error)
func (*ComposedCmd) VerboseString ¶
func (cc *ComposedCmd) VerboseString() string
type MVCCChain ¶ added in v0.6.0
type MVCCChain[T txnif.MVCCNode[T]] struct { *sync.RWMutex MVCC *common.GenericSortedDList[T] // contains filtered or unexported fields }
func NewMVCCChain ¶ added in v0.6.0
func (*MVCCChain[T]) Apply1PCCommit ¶ added in v0.6.0
func (*MVCCChain[T]) ApplyCommit ¶ added in v0.6.0
func (*MVCCChain[T]) ApplyRollback ¶ added in v0.6.0
func (*MVCCChain[T]) CheckConflict ¶ added in v0.6.0
func (*MVCCChain[T]) CloneCommittedInRange ¶ added in v0.6.0
func (*MVCCChain[T]) CloneLatestNode ¶ added in v0.6.0
func (*MVCCChain[T]) ClonePreparedInRange ¶ added in v0.6.0
ClonePreparedInRange will collect all txn node prepared in the time window. Wait txn to complete committing if it didn't.
func (*MVCCChain[T]) GetLatestCommittedNode ¶ added in v0.6.0
func (be *MVCCChain[T]) GetLatestCommittedNode() (node T)
GetLatestCommittedNode gets the latest committed mvcc node. It's useful when check whether the catalog/metadata entry is deleted.
func (*MVCCChain[T]) GetLatestNodeLocked ¶ added in v0.6.0
func (be *MVCCChain[T]) GetLatestNodeLocked() T
GetLatestNodeLocked gets the latest mvcc node. It is useful in making command, apply state(e.g. ApplyCommit), check confilct.
func (*MVCCChain[T]) GetPrepareTs ¶ added in v0.6.0
for replay
func (*MVCCChain[T]) GetVisibleNode ¶ added in v0.6.0
GetVisibleNode gets mvcc node according to the txnReader. It returns the mvcc node in the same txn as the read txn or returns the latest mvcc node with commitTS less than the timestamp.
func (*MVCCChain[T]) GetVisibleNodeByTS ¶ added in v0.8.0
GetVisibleNode gets mvcc node according to the timestamp. It returns the latest mvcc node with commitTS less than the timestamp.
func (*MVCCChain[T]) HasCommittedNode ¶ added in v0.6.0
func (*MVCCChain[T]) HasCommittedNodeInRange ¶ added in v0.6.0
[start, end] Check whether there is any committed node in between [start, end] -----+------+-------+--------+----------+--------->
| | | | | Time | start | end | commitTs <----- commitTs <--------- commitTs|uncommitted <= MVCCChain Header (1) (2) (3)
func (*MVCCChain[T]) HasUncommittedNode ¶ added in v0.6.0
func (*MVCCChain[T]) Insert ¶ added in v0.6.0
func (be *MVCCChain[T]) Insert(vun T) (node *common.GenericDLNode[T])
func (*MVCCChain[T]) IsCommitted ¶ added in v0.6.0
func (*MVCCChain[T]) IsCommitting ¶ added in v0.6.0
In /Catalog, there're three states: Active, Committing and Committed. A txn is Active before its CommitTs is allocated. It's Committed when its state will never change, i.e. TxnStateCommitted and TxnStateRollbacked. It's Committing when it's in any other state, including TxnStateCommitting, TxnStateRollbacking, TxnStatePrepared and so on. When read or write an entry, if the last txn of the entry is Committing, we wait for it. When write on an Entry, if there's an Active txn, we report w-w conflict.
func (*MVCCChain[T]) IsCreatingOrAborted ¶ added in v0.6.0
func (*MVCCChain[T]) MustOneNodeLocked ¶ added in v0.6.0
func (*MVCCChain[T]) NeedWaitCommitting ¶ added in v0.6.0
func (*MVCCChain[T]) PrepareCommit ¶ added in v0.6.0
func (*MVCCChain[T]) PrepareRollback ¶ added in v0.6.0
func (*MVCCChain[T]) ReadAllFrom ¶ added in v0.6.0
func (*MVCCChain[T]) ReadOneNodeFrom ¶ added in v0.6.0
func (*MVCCChain[T]) SearchNode ¶ added in v0.6.0
func (be *MVCCChain[T]) SearchNode(o T) (node T)
It's only used in replay
func (*MVCCChain[T]) StringLocked ¶ added in v0.6.0
func (*MVCCChain[T]) WriteAllTo ¶ added in v0.6.0
type MVCCSlice ¶ added in v0.6.0
func NewMVCCSlice ¶ added in v0.6.0
func (*MVCCSlice[T]) DeleteNode ¶ added in v0.6.0
func (be *MVCCSlice[T]) DeleteNode(node T)
func (*MVCCSlice[T]) GetCommittedNode ¶ added in v0.6.0
func (be *MVCCSlice[T]) GetCommittedNode() (node T)
GetCommittedNode gets the latest committed UpdateNode. It's useful when check whether the catalog/metadata entry is deleted.
func (*MVCCSlice[T]) GetLastNonAbortedNode ¶ added in v0.6.0
func (be *MVCCSlice[T]) GetLastNonAbortedNode() (node T)
func (*MVCCSlice[T]) GetNodeByOffset ¶ added in v0.6.0
func (*MVCCSlice[T]) GetNodeToReadByPrepareTS ¶ added in v0.6.0
GetNodeToRead gets UpdateNode according to the timestamp. It returns the UpdateNode in the same txn as the read txn or returns the latest UpdateNode with commitTS less than the timestamp. todo getend or getcommitts
func (*MVCCSlice[T]) GetUpdateNodeLocked ¶ added in v0.6.0
func (be *MVCCSlice[T]) GetUpdateNodeLocked() T
GetUpdateNode gets the latest UpdateNode. It is useful in making command, apply state(e.g. ApplyCommit), check confilct.
func (*MVCCSlice[T]) InsertNode ¶ added in v0.6.0
func (be *MVCCSlice[T]) InsertNode(un T)
func (*MVCCSlice[T]) IsCommitted ¶ added in v0.6.0
func (*MVCCSlice[T]) IsCommitting ¶ added in v0.6.0
func (*MVCCSlice[T]) LoopInRange ¶ added in v0.6.0
func (*MVCCSlice[T]) LoopOffsetRange ¶ added in v0.6.0
func (*MVCCSlice[T]) SearchNode ¶ added in v0.6.0
func (be *MVCCSlice[T]) SearchNode(o T) (node T)
func (*MVCCSlice[T]) SearchNodeByCompareFn ¶ added in v0.6.0
func (*MVCCSlice[T]) SearchNodeByTS ¶ added in v0.6.0
func (*MVCCSlice[T]) StringLocked ¶ added in v0.6.0
type NoopCommitListener ¶ added in v0.6.0
type NoopCommitListener struct{}
func (*NoopCommitListener) OnBeginPrePrepare ¶ added in v0.6.0
func (bl *NoopCommitListener) OnBeginPrePrepare(txn txnif.AsyncTxn)
func (*NoopCommitListener) OnEndPrePrepare ¶ added in v0.6.0
func (bl *NoopCommitListener) OnEndPrePrepare(txn txnif.AsyncTxn)
type NoopTxnStore ¶
type NoopTxnStore struct{}
func (*NoopTxnStore) AddBlksWithMetaLoc ¶ added in v0.7.0
func (*NoopTxnStore) AddTxnEntry ¶
func (store *NoopTxnStore) AddTxnEntry(t txnif.TxnEntryType, entry txnif.TxnEntry)
func (*NoopTxnStore) AddWaitEvent ¶ added in v0.8.0
func (store *NoopTxnStore) AddWaitEvent(cnt int)
func (*NoopTxnStore) Append ¶
func (store *NoopTxnStore) Append(ctx context.Context, dbId, id uint64, data *containers.Batch) error
func (*NoopTxnStore) Apply2PCPrepare ¶ added in v0.6.0
func (store *NoopTxnStore) Apply2PCPrepare() error
func (*NoopTxnStore) ApplyCommit ¶
func (store *NoopTxnStore) ApplyCommit() error
func (*NoopTxnStore) ApplyRollback ¶
func (store *NoopTxnStore) ApplyRollback() error
func (*NoopTxnStore) BatchDedup ¶
func (store *NoopTxnStore) BatchDedup(uint64, uint64, containers.Vector) (err error)
func (*NoopTxnStore) BindTxn ¶
func (store *NoopTxnStore) BindTxn(txn txnif.AsyncTxn)
func (*NoopTxnStore) Close ¶
func (store *NoopTxnStore) Close() error
func (*NoopTxnStore) CreateBlock ¶
func (*NoopTxnStore) CreateDatabase ¶
func (store *NoopTxnStore) CreateDatabase(name, creatSql, datTyp string) (db handle.Database, err error)
func (*NoopTxnStore) CreateDatabaseWithID ¶ added in v0.6.0
func (*NoopTxnStore) CreateNonAppendableBlock ¶
func (store *NoopTxnStore) CreateNonAppendableBlock(*common.ID, *objectio.CreateBlockOpt) (blk handle.Block, err error)
func (*NoopTxnStore) CreateNonAppendableSegment ¶
func (*NoopTxnStore) CreateRelation ¶
func (*NoopTxnStore) CreateRelationWithTableId ¶ added in v0.6.0
func (*NoopTxnStore) CreateSegment ¶
func (*NoopTxnStore) DatabaseNames ¶
func (store *NoopTxnStore) DatabaseNames() (names []string)
func (*NoopTxnStore) DoneWaitEvent ¶ added in v0.8.0
func (store *NoopTxnStore) DoneWaitEvent(cnt int)
func (*NoopTxnStore) DropDatabase ¶
func (store *NoopTxnStore) DropDatabase(name string) (db handle.Database, err error)
func (*NoopTxnStore) DropDatabaseByID ¶ added in v0.6.0
func (store *NoopTxnStore) DropDatabaseByID(id uint64) (db handle.Database, err error)
func (*NoopTxnStore) DropRelationByID ¶ added in v0.6.0
func (*NoopTxnStore) DropRelationByName ¶
func (*NoopTxnStore) Freeze ¶ added in v0.8.0
func (store *NoopTxnStore) Freeze() error
func (*NoopTxnStore) GetByFilter ¶
func (*NoopTxnStore) GetContext ¶ added in v0.8.0
func (store *NoopTxnStore) GetContext() context.Context
func (*NoopTxnStore) GetDatabase ¶
func (store *NoopTxnStore) GetDatabase(name string) (db handle.Database, err error)
func (*NoopTxnStore) GetDatabaseByID ¶ added in v0.6.0
func (store *NoopTxnStore) GetDatabaseByID(id uint64) (db handle.Database, err error)
func (*NoopTxnStore) GetDirty ¶ added in v0.6.0
func (store *NoopTxnStore) GetDirty() *model.Tree
func (*NoopTxnStore) GetDirtyTableByID ¶ added in v0.6.0
func (store *NoopTxnStore) GetDirtyTableByID(id uint64) *model.TableTree
func (*NoopTxnStore) GetLSN ¶
func (store *NoopTxnStore) GetLSN() uint64
func (*NoopTxnStore) GetRelationByID ¶ added in v0.6.0
func (*NoopTxnStore) GetRelationByName ¶
func (*NoopTxnStore) GetSegment ¶
func (*NoopTxnStore) GetTransactionType ¶ added in v0.8.0
func (store *NoopTxnStore) GetTransactionType() txnif.TxnType
func (*NoopTxnStore) HasAnyTableDataChanges ¶ added in v0.6.0
func (store *NoopTxnStore) HasAnyTableDataChanges() bool
func (*NoopTxnStore) HasCatalogChanges ¶ added in v0.6.0
func (store *NoopTxnStore) HasCatalogChanges() bool
func (*NoopTxnStore) HasTableDataChanges ¶ added in v0.6.0
func (store *NoopTxnStore) HasTableDataChanges(id uint64) bool
func (*NoopTxnStore) IncreateWriteCnt ¶
func (store *NoopTxnStore) IncreateWriteCnt() int
func (*NoopTxnStore) IsReadonly ¶
func (store *NoopTxnStore) IsReadonly() bool
func (*NoopTxnStore) LogTxnEntry ¶
func (*NoopTxnStore) LogTxnState ¶ added in v0.6.0
func (store *NoopTxnStore) LogTxnState(sync bool) (logEntry entry.Entry, err error)
func (*NoopTxnStore) ObserveTxn ¶ added in v0.8.0
func (*NoopTxnStore) PreApplyCommit ¶
func (store *NoopTxnStore) PreApplyCommit() error
func (*NoopTxnStore) PrePrepare ¶ added in v0.6.0
func (store *NoopTxnStore) PrePrepare(ctx context.Context) error
func (*NoopTxnStore) PrepareCommit ¶
func (store *NoopTxnStore) PrepareCommit() error
func (*NoopTxnStore) PrepareRollback ¶
func (store *NoopTxnStore) PrepareRollback() error
func (*NoopTxnStore) PrepareWAL ¶ added in v0.8.0
func (store *NoopTxnStore) PrepareWAL() error
func (*NoopTxnStore) RangeDelete ¶
func (store *NoopTxnStore) RangeDelete(*common.ID, uint32, uint32, handle.DeleteType) (err error)
func (*NoopTxnStore) SoftDeleteBlock ¶
func (store *NoopTxnStore) SoftDeleteBlock(id *common.ID) (err error)
func (*NoopTxnStore) SoftDeleteSegment ¶
func (store *NoopTxnStore) SoftDeleteSegment(id *common.ID) (err error)
func (*NoopTxnStore) UnsafeGetDatabase ¶ added in v0.6.0
func (store *NoopTxnStore) UnsafeGetDatabase(id uint64) (db handle.Database, err error)
func (*NoopTxnStore) UnsafeGetRelation ¶ added in v0.6.0
func (store *NoopTxnStore) UnsafeGetRelation(dbId, id uint64) (rel handle.Relation, err error)
func (*NoopTxnStore) UpdateDeltaLoc ¶ added in v0.6.0
func (*NoopTxnStore) UpdateMetaLoc ¶ added in v0.6.0
func (*NoopTxnStore) WaitPrepared ¶ added in v0.6.0
func (store *NoopTxnStore) WaitPrepared(ctx context.Context) (err error)
type OpTxn ¶
func (*OpTxn) IsTryCommitting ¶ added in v0.6.0
type Txn ¶
type Txn struct { *TxnCtx Mgr *TxnManager Store txnif.TxnStore Err error LSN uint64 TenantID, UserID, RoleID atomic.Uint32 DedupType txnif.DedupType PrepareCommitFn func(txnif.AsyncTxn) error PrepareRollbackFn func(txnif.AsyncTxn) error ApplyCommitFn func(txnif.AsyncTxn) error ApplyRollbackFn func(txnif.AsyncTxn) error // contains filtered or unexported fields }
func MockTxnReaderWithStartTS ¶ added in v0.8.0
func NewPersistedTxn ¶ added in v0.6.0
func (*Txn) ApplyCommit ¶
func (*Txn) ApplyRollback ¶
func (*Txn) BindAccessInfo ¶ added in v0.6.0
func (*Txn) Commit ¶
Commit is used to commit a 1PC or 2PC transaction running on Coordinator or running on Participant. Notice that the Commit of a 2PC transaction must be success once the Commit message arrives, since Preparing had already succeeded.
func (*Txn) CommitInRecovery ¶ added in v0.6.0
CommitInRecovery is called during recovery
func (*Txn) Committing ¶ added in v0.6.0
Committing is used to record a "committing" status for coordinator. Notice that txn must commit successfully once committing message arrives, since Preparing had already succeeded.
func (*Txn) CommittingInRecovery ¶ added in v0.6.0
func (*Txn) CreateDatabase ¶
func (*Txn) CreateDatabaseWithCtx ¶ added in v0.8.0
func (*Txn) CurrentDatabase ¶
func (*Txn) DatabaseNames ¶
func (*Txn) DoneWithErr ¶
func (*Txn) DropDatabase ¶
func (*Txn) DropDatabaseByID ¶ added in v0.6.0
func (*Txn) GetContext ¶ added in v0.8.0
func (*Txn) GetDatabaseByID ¶ added in v0.6.0
func (*Txn) GetDatabaseWithCtx ¶ added in v0.8.0
func (*Txn) GetDedupType ¶ added in v0.8.0
func (*Txn) GetTenantID ¶ added in v0.6.0
func (*Txn) GetUserAndRoleID ¶ added in v0.6.0
func (*Txn) LogTxnEntry ¶
func (*Txn) LogTxnState ¶ added in v0.6.0
func (*Txn) MarshalLogObject ¶
func (txn *Txn) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
func (*Txn) MockIncWriteCnt ¶
func (*Txn) PreApplyCommit ¶
func (*Txn) Prepare ¶ added in v0.6.0
Prepare is used to pre-commit a 2PC distributed transaction. Notice that once any error happened, we should rollback the txn. TODO:
- How to handle the case in which log service timed out?
- For a 2pc transaction, Rollback message may arrive before Prepare message, should handle this case by TxnStorage?
func (*Txn) PrepareCommit ¶
func (*Txn) PrepareRollback ¶
func (*Txn) PrepareWAL ¶ added in v0.8.0
func (*Txn) Rollback ¶
Rollback is used to roll back a 1PC or 2PC transaction. Notice that there may be a such scenario in which a 2PC distributed transaction in ACTIVE will be rollbacked, since Rollback message may arrive before the Prepare message.
func (*Txn) SetDedupType ¶ added in v0.8.0
func (*Txn) SetPrepareRollbackFn ¶
func (*Txn) UnsafeGetDatabase ¶ added in v0.6.0
func (*Txn) UnsafeGetRelation ¶ added in v0.6.0
func (*Txn) UseDatabase ¶
type TxnBlock ¶
func (*TxnBlock) Fingerprint ¶
func (*TxnBlock) GetByFilter ¶
func (*TxnBlock) GetSegment ¶
func (*TxnBlock) GetTotalChanges ¶
func (*TxnBlock) IsAppendableBlock ¶
func (*TxnBlock) PushUpdateOp ¶
func (*TxnBlock) RangeDelete ¶
type TxnCmd ¶ added in v0.6.0
type TxnCmd struct { *ComposedCmd *TxnCtx Txn txnif.AsyncTxn Lsn uint64 // contains filtered or unexported fields }
func NewEmptyTxnCmd ¶ added in v0.6.0
func NewEmptyTxnCmd() *TxnCmd
func NewLastTxnCmd ¶ added in v0.8.0
func NewLastTxnCmd() *TxnCmd
func (*TxnCmd) ApplyCommit ¶ added in v0.6.0
func (c *TxnCmd) ApplyCommit()
func (*TxnCmd) ApplyRollback ¶ added in v0.6.0
func (c *TxnCmd) ApplyRollback()
func (*TxnCmd) MarshalBinary ¶ added in v0.8.0
func (*TxnCmd) SetReplayTxn ¶ added in v0.6.0
func (*TxnCmd) UnmarshalBinary ¶ added in v0.8.0
func (*TxnCmd) VerboseString ¶ added in v0.6.0
type TxnCommitListener ¶ added in v0.6.0
type TxnCtx ¶
type TxnCtx struct { sync.RWMutex sync.WaitGroup DoneCond sync.Cond ID string IDCtx []byte StartTS, CommitTS, PrepareTS types.TS // SnapshotTS is the specified snapshot timestamp used by this txn SnapshotTS types.TS State txnif.TxnState Participants []uint64 // Memo is not thread-safe // It will be readonly when txn state is not txnif.TxnStateActive Memo *txnif.TxnMemo }
func NewEmptyTxnCtx ¶ added in v0.6.0
func NewEmptyTxnCtx() *TxnCtx
func (*TxnCtx) CommitBefore ¶ added in v0.5.1
func (*TxnCtx) GetCommitTS ¶
func (*TxnCtx) GetParticipants ¶ added in v0.6.0
func (*TxnCtx) GetPrepareTS ¶ added in v0.6.0
func (*TxnCtx) GetSnapshotTS ¶ added in v0.8.0
func (*TxnCtx) GetStartTS ¶
func (*TxnCtx) GetTxnState ¶ added in v0.6.0
False when atomically get the current txn state
True when the txn state is committing, wait it to be committed or rollbacked. It is used during snapshot reads. If TxnStateActive is currently returned, this value will definitely not be used, because even if it becomes TxnStatePreparing later, the timestamp would be larger than the current read timestamp.
func (*TxnCtx) HasSnapshotLag ¶ added in v0.8.0
func (*TxnCtx) IsActiveLocked ¶
func (*TxnCtx) MockStartTS ¶ added in v0.8.0
test only Note: unsafe
func (*TxnCtx) SetCommitTS ¶ added in v0.6.0
func (*TxnCtx) SetParticipants ¶ added in v0.6.0
func (*TxnCtx) SetSnapshotTS ¶ added in v0.8.0
func (*TxnCtx) ToCommittedLocked ¶
func (*TxnCtx) ToCommittingFinished ¶ added in v0.6.0
func (*TxnCtx) ToCommittingFinishedLocked ¶ added in v0.6.0
func (*TxnCtx) ToPrepared ¶ added in v0.6.0
func (*TxnCtx) ToPreparedLocked ¶ added in v0.6.0
func (*TxnCtx) ToPreparingLocked ¶ added in v0.6.0
func (*TxnCtx) ToRollbackedLocked ¶
func (*TxnCtx) ToUnknownLocked ¶
func (ctx *TxnCtx) ToUnknownLocked()
type TxnDatabase ¶
func (*TxnDatabase) Close ¶
func (db *TxnDatabase) Close() error
func (*TxnDatabase) CreateRelation ¶
func (db *TxnDatabase) CreateRelation(def any) (rel handle.Relation, err error)
func (*TxnDatabase) DropRelationByName ¶
func (db *TxnDatabase) DropRelationByName(name string) (rel handle.Relation, err error)
func (*TxnDatabase) GetID ¶
func (db *TxnDatabase) GetID() uint64
func (*TxnDatabase) GetMeta ¶
func (db *TxnDatabase) GetMeta() any
func (*TxnDatabase) GetName ¶
func (db *TxnDatabase) GetName() string
func (*TxnDatabase) GetRelationByName ¶
func (db *TxnDatabase) GetRelationByName(name string) (rel handle.Relation, err error)
func (*TxnDatabase) MakeRelationIt ¶
func (db *TxnDatabase) MakeRelationIt() (it handle.RelationIt)
func (*TxnDatabase) RelationCnt ¶
func (db *TxnDatabase) RelationCnt() int64
func (*TxnDatabase) Relations ¶
func (db *TxnDatabase) Relations() (rels []handle.Relation)
func (*TxnDatabase) String ¶
func (db *TxnDatabase) String() string
func (*TxnDatabase) UnsafeGetRelation ¶ added in v0.6.0
func (db *TxnDatabase) UnsafeGetRelation(id uint64) (rel handle.Relation, err error)
type TxnFactory ¶
type TxnMVCCNode ¶ added in v0.6.0
type TxnMVCCNode struct {
Start, Prepare, End types.TS
Txn txnif.TxnReader
Aborted bool
// contains filtered or unexported fields
}
func NewTxnMVCCNodeWithTS ¶ added in v0.6.0
func NewTxnMVCCNodeWithTS(ts types.TS) *TxnMVCCNode
func NewTxnMVCCNodeWithTxn ¶ added in v0.6.0
func NewTxnMVCCNodeWithTxn(txn txnif.TxnReader) *TxnMVCCNode
func ReadTuple ¶ added in v0.6.0
func ReadTuple(bat *containers.Batch, row int) (un *TxnMVCCNode)
func (*TxnMVCCNode) AppendTuple ¶ added in v0.6.0
func (un *TxnMVCCNode) AppendTuple(bat *containers.Batch)
func (*TxnMVCCNode) ApplyCommit ¶ added in v0.6.0
func (un *TxnMVCCNode) ApplyCommit() (ts types.TS, err error)
func (*TxnMVCCNode) ApplyRollback ¶ added in v0.6.0
func (un *TxnMVCCNode) ApplyRollback() (ts types.TS, err error)
func (*TxnMVCCNode) CheckConflict ¶ added in v0.6.0
func (un *TxnMVCCNode) CheckConflict(txn txnif.TxnReader) error
Check w-w confilct
func (*TxnMVCCNode) CloneAll ¶ added in v0.6.0
func (un *TxnMVCCNode) CloneAll() *TxnMVCCNode
func (*TxnMVCCNode) CommittedIn ¶ added in v0.6.0
func (un *TxnMVCCNode) CommittedIn(minTS, maxTS types.TS) (in, before bool)
in indicates whether this node is committed in between [minTs, maxTs] before indicates whether this node is committed before minTs NeedWaitCommitting should be called before to make sure all prepared active txns in between [minTs, maxTs] be committed or rollbacked
func (*TxnMVCCNode) Compare ¶ added in v0.6.0
func (un *TxnMVCCNode) Compare(o *TxnMVCCNode) int
func (*TxnMVCCNode) Compare2 ¶ added in v0.6.0
func (un *TxnMVCCNode) Compare2(o *TxnMVCCNode) int
func (*TxnMVCCNode) GetEnd ¶ added in v0.6.0
func (un *TxnMVCCNode) GetEnd() types.TS
func (*TxnMVCCNode) GetPrepare ¶ added in v0.6.0
func (un *TxnMVCCNode) GetPrepare() types.TS
func (*TxnMVCCNode) GetStart ¶ added in v0.6.0
func (un *TxnMVCCNode) GetStart() types.TS
func (*TxnMVCCNode) GetTxn ¶ added in v0.6.0
func (un *TxnMVCCNode) GetTxn() txnif.TxnReader
func (*TxnMVCCNode) Is1PC ¶ added in v0.6.0
func (un *TxnMVCCNode) Is1PC() bool
func (*TxnMVCCNode) IsAborted ¶ added in v0.6.0
func (un *TxnMVCCNode) IsAborted() bool
func (*TxnMVCCNode) IsActive ¶ added in v0.6.0
func (un *TxnMVCCNode) IsActive() bool
func (*TxnMVCCNode) IsCommitted ¶ added in v0.6.0
func (un *TxnMVCCNode) IsCommitted() bool
func (*TxnMVCCNode) IsCommitting ¶ added in v0.6.0
func (un *TxnMVCCNode) IsCommitting() bool
func (*TxnMVCCNode) IsSameTxn ¶ added in v0.6.0
func (un *TxnMVCCNode) IsSameTxn(txn txnif.TxnReader) bool
func (*TxnMVCCNode) IsVisible ¶ added in v0.6.0
func (un *TxnMVCCNode) IsVisible(txn txnif.TxnReader) (visible bool)
Check whether is mvcc node is visible to ts Make sure all the relevant prepared txns should be committed|rollbacked
func (*TxnMVCCNode) IsVisibleByTS ¶ added in v0.8.0
func (un *TxnMVCCNode) IsVisibleByTS(ts types.TS) (visible bool)
Check whether is mvcc node is visible to ts Make sure all the relevant prepared txns should be committed|rollbacked
func (*TxnMVCCNode) NeedWaitCommitting ¶ added in v0.6.0
Check whether need to wait this mvcc node
func (*TxnMVCCNode) PrepareCommit ¶ added in v0.6.0
func (un *TxnMVCCNode) PrepareCommit() (ts types.TS, err error)
func (*TxnMVCCNode) PrepareRollback ¶ added in v0.6.0
func (un *TxnMVCCNode) PrepareRollback() (err error)
func (*TxnMVCCNode) PreparedIn ¶ added in v0.6.0
func (un *TxnMVCCNode) PreparedIn(minTS, maxTS types.TS) (in, before bool)
func (*TxnMVCCNode) ReadFrom ¶ added in v0.6.0
func (un *TxnMVCCNode) ReadFrom(r io.Reader) (n int64, err error)
func (*TxnMVCCNode) ReadTuple ¶ added in v0.6.0
func (un *TxnMVCCNode) ReadTuple(bat *containers.Batch, offset int)
func (*TxnMVCCNode) Set1PC ¶ added in v0.6.0
func (un *TxnMVCCNode) Set1PC()
func (*TxnMVCCNode) String ¶ added in v0.6.0
func (un *TxnMVCCNode) String() string
func (*TxnMVCCNode) Update ¶ added in v0.6.0
func (un *TxnMVCCNode) Update(o *TxnMVCCNode)
type TxnManager ¶
type TxnManager struct { sync.RWMutex sm.ClosedState PreparingSM sm.StateMachine FlushQueue sm.Queue IDMap map[string]txnif.AsyncTxn IdAlloc *common.TxnIDAllocator TsAlloc *types.TsAlloctor MaxCommittedTS atomic.Pointer[types.TS] TxnStoreFactory TxnStoreFactory TxnFactory TxnFactory Exception *atomic.Value CommitListener *batchTxnCommitListener // contains filtered or unexported fields }
func NewTxnManager ¶
func NewTxnManager(txnStoreFactory TxnStoreFactory, txnFactory TxnFactory, clock clock.Clock) *TxnManager
func (*TxnManager) DeleteTxn ¶
func (mgr *TxnManager) DeleteTxn(id string) (err error)
func (*TxnManager) EnqueueFlushing ¶ added in v0.6.0
func (mgr *TxnManager) EnqueueFlushing(op any) (err error)
func (*TxnManager) GetOrCreateTxnWithMeta ¶ added in v0.6.0
func (mgr *TxnManager) GetOrCreateTxnWithMeta( info []byte, id []byte, ts types.TS) (txn txnif.AsyncTxn, err error)
GetOrCreateTxnWithMeta Get or create a txn initiated by CN
func (*TxnManager) GetTxnByCtx ¶
func (mgr *TxnManager) GetTxnByCtx(ctx []byte) txnif.AsyncTxn
func (*TxnManager) MarshalLogObject ¶
func (mgr *TxnManager) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
func (*TxnManager) MinTSForTest ¶ added in v0.7.0
func (mgr *TxnManager) MinTSForTest() types.TS
MinTSForTest is only be used in ut to ensure that files that have been gc will not be used.
func (*TxnManager) Now ¶ added in v0.8.0
func (mgr *TxnManager) Now() types.TS
Now gets a timestamp under the protect from a inner lock. The lock makes all timestamps allocated before have been assigned to txn, which means those txn are visible for the returned timestamp.
func (*TxnManager) OnCommitTxn ¶ added in v0.8.0
func (mgr *TxnManager) OnCommitTxn(txn txnif.AsyncTxn)
func (*TxnManager) OnException ¶
func (mgr *TxnManager) OnException(new error)
func (*TxnManager) OnOpTxn ¶
func (mgr *TxnManager) OnOpTxn(op *OpTxn) (err error)
func (*TxnManager) OnReplayTxn ¶ added in v0.6.0
func (mgr *TxnManager) OnReplayTxn(txn txnif.AsyncTxn) (err error)
Note: Replay should always runs in a single thread
func (*TxnManager) Start ¶ added in v0.6.0
func (mgr *TxnManager) Start(ctx context.Context)
func (*TxnManager) StartTxn ¶
func (mgr *TxnManager) StartTxn(info []byte) (txn txnif.AsyncTxn, err error)
StartTxn starts a local transaction initiated by DN
func (*TxnManager) StartTxnWithLatestTS ¶ added in v0.8.0
func (mgr *TxnManager) StartTxnWithLatestTS(info []byte) (txn txnif.AsyncTxn, err error)
StartTxn starts a local transaction initiated by DN
func (*TxnManager) StatMaxCommitTS ¶ added in v0.6.0
func (mgr *TxnManager) StatMaxCommitTS() (ts types.TS)
func (*TxnManager) Stop ¶
func (mgr *TxnManager) Stop()
type TxnRelation ¶
func (*TxnRelation) AddBlksWithMetaLoc ¶ added in v0.7.0
func (*TxnRelation) AlterTable ¶ added in v0.8.0
func (rel *TxnRelation) AlterTable(context.Context, *apipb.AlterTableReq) (err error)
func (*TxnRelation) Append ¶
func (rel *TxnRelation) Append(ctx context.Context, data *containers.Batch) error
func (*TxnRelation) BatchDedup ¶
func (rel *TxnRelation) BatchDedup(col containers.Vector) error
func (*TxnRelation) Close ¶
func (rel *TxnRelation) Close() error
func (*TxnRelation) CreateNonAppendableSegment ¶
func (rel *TxnRelation) CreateNonAppendableSegment(bool) (seg handle.Segment, err error)
func (*TxnRelation) CreateSegment ¶
func (rel *TxnRelation) CreateSegment(bool) (seg handle.Segment, err error)
func (*TxnRelation) DeleteByFilter ¶
func (*TxnRelation) DeleteByPhyAddrKey ¶ added in v0.6.0
func (rel *TxnRelation) DeleteByPhyAddrKey(any) (err error)
func (*TxnRelation) DeleteByPhyAddrKeys ¶ added in v0.6.0
func (rel *TxnRelation) DeleteByPhyAddrKeys(containers.Vector) (err error)
func (*TxnRelation) GetByFilter ¶
func (*TxnRelation) GetCardinality ¶
func (rel *TxnRelation) GetCardinality(attr string) int64
func (*TxnRelation) GetDB ¶ added in v0.8.0
func (rel *TxnRelation) GetDB() (handle.Database, error)
func (*TxnRelation) GetMeta ¶
func (rel *TxnRelation) GetMeta() any
func (*TxnRelation) GetSegment ¶
func (*TxnRelation) GetValueByFilter ¶
func (*TxnRelation) GetValueByPhyAddrKey ¶ added in v0.6.0
func (*TxnRelation) ID ¶
func (rel *TxnRelation) ID() uint64
func (*TxnRelation) LogTxnEntry ¶
func (*TxnRelation) MakeBlockIt ¶
func (rel *TxnRelation) MakeBlockIt() handle.BlockIt
func (*TxnRelation) MakeSegmentIt ¶
func (rel *TxnRelation) MakeSegmentIt() handle.SegmentIt
func (*TxnRelation) MakeSegmentItOnSnap ¶ added in v0.8.0
func (rel *TxnRelation) MakeSegmentItOnSnap() handle.SegmentIt
func (*TxnRelation) RangeDelete ¶
func (rel *TxnRelation) RangeDelete(*common.ID, uint32, uint32, handle.DeleteType) (err error)
func (*TxnRelation) Rows ¶
func (rel *TxnRelation) Rows() int64
func (*TxnRelation) Schema ¶
func (rel *TxnRelation) Schema() any
func (*TxnRelation) SimplePPString ¶
func (rel *TxnRelation) SimplePPString(_ common.PPLevel) string
func (*TxnRelation) Size ¶
func (rel *TxnRelation) Size(attr string) int64
func (*TxnRelation) SoftDeleteSegment ¶
func (rel *TxnRelation) SoftDeleteSegment(id *types.Segmentid) (err error)
func (*TxnRelation) String ¶
func (rel *TxnRelation) String() string
type TxnSegment ¶
func (*TxnSegment) BatchDedup ¶
func (seg *TxnSegment) BatchDedup(containers.Vector) (err error)
func (*TxnSegment) Close ¶
func (seg *TxnSegment) Close() error
func (*TxnSegment) CreateBlock ¶
func (seg *TxnSegment) CreateBlock() (blk handle.Block, err error)
func (*TxnSegment) CreateNonAppendableBlock ¶
func (seg *TxnSegment) CreateNonAppendableBlock() (blk handle.Block, err error)
func (*TxnSegment) GetBlock ¶
func (seg *TxnSegment) GetBlock(id uint64) (blk handle.Block, err error)
func (*TxnSegment) GetID ¶
func (seg *TxnSegment) GetID() uint64
func (*TxnSegment) GetMeta ¶
func (seg *TxnSegment) GetMeta() any
func (*TxnSegment) GetRelation ¶
func (seg *TxnSegment) GetRelation() (rel handle.Relation)
func (*TxnSegment) MakeBlockIt ¶
func (seg *TxnSegment) MakeBlockIt() (it handle.BlockIt)
func (*TxnSegment) PushDeleteOp ¶
func (seg *TxnSegment) PushDeleteOp(handle.Filter) (err error)
func (*TxnSegment) PushUpdateOp ¶
func (*TxnSegment) RangeDelete ¶
func (seg *TxnSegment) RangeDelete(uint64, uint32, uint32, handle.DeleteType) (err error)
func (*TxnSegment) Reset ¶ added in v0.8.0
func (seg *TxnSegment) Reset()
func (*TxnSegment) SoftDeleteBlock ¶
func (seg *TxnSegment) SoftDeleteBlock(id types.Blockid) (err error)
func (*TxnSegment) String ¶
func (seg *TxnSegment) String() string
type TxnState ¶
type TxnState struct {
// contains filtered or unexported fields
}
func (*TxnState) IsCommitted ¶
func (*TxnState) IsRollbacked ¶
func (*TxnState) IsUncommitted ¶
func (*TxnState) ToCommitted ¶
func (*TxnState) ToCommitting ¶
func (*TxnState) ToRollbacked ¶
func (*TxnState) ToRollbacking ¶
type TxnStateCmd ¶ added in v0.6.0
func NewEmptyTxnStateCmd ¶ added in v0.6.0
func NewEmptyTxnStateCmd() *TxnStateCmd
func NewTxnStateCmd ¶ added in v0.6.0
func (*TxnStateCmd) ApplyCommit ¶ added in v0.6.0
func (c *TxnStateCmd) ApplyCommit()
func (*TxnStateCmd) ApplyRollback ¶ added in v0.6.0
func (c *TxnStateCmd) ApplyRollback()
func (*TxnStateCmd) Close ¶ added in v0.6.0
func (c *TxnStateCmd) Close()
func (*TxnStateCmd) Desc ¶ added in v0.6.0
func (c *TxnStateCmd) Desc() string
func (*TxnStateCmd) GetType ¶ added in v0.6.0
func (c *TxnStateCmd) GetType() uint16
func (*TxnStateCmd) MarshalBinary ¶ added in v0.8.0
func (c *TxnStateCmd) MarshalBinary() (buf []byte, err error)
func (*TxnStateCmd) ReadFrom ¶ added in v0.6.0
func (c *TxnStateCmd) ReadFrom(r io.Reader) (n int64, err error)
func (*TxnStateCmd) SetReplayTxn ¶ added in v0.6.0
func (c *TxnStateCmd) SetReplayTxn(_ txnif.AsyncTxn)
func (*TxnStateCmd) String ¶ added in v0.6.0
func (c *TxnStateCmd) String() string
func (*TxnStateCmd) UnmarshalBinary ¶ added in v0.8.0
func (c *TxnStateCmd) UnmarshalBinary(buf []byte) (err error)
func (*TxnStateCmd) VerboseString ¶ added in v0.6.0
func (c *TxnStateCmd) VerboseString() string