Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterCmdFactory(cmdType int16, factory CmdFactory)
- func TxnStrState(state TxnState) string
- type AppendNode
- type AsyncTxn
- type BaseMVCCNode
- type BaseNode
- type CmdFactory
- type CmdType
- type DedupType
- type DeleteChain
- type DeleteNode
- type MVCCNode
- type Txn2PC
- type TxnAsyncer
- type TxnChanger
- type TxnCmd
- type TxnEntry
- type TxnEntryType
- type TxnHandle
- type TxnMemo
- func (memo *TxnMemo) AddCatalogChange()
- func (memo *TxnMemo) GetDirty() *model.Tree
- func (memo *TxnMemo) GetDirtyTableByID(id uint64) *model.TableTree
- func (memo *TxnMemo) HasAnyTableDataChanges() bool
- func (memo *TxnMemo) HasCatalogChanges() bool
- func (memo *TxnMemo) HasTableDataChanges(id uint64) bool
- func (memo *TxnMemo) ReadFrom(r io.Reader) (n int64, err error)
- func (memo *TxnMemo) WriteTo(w io.Writer) (n int64, err error)
- type TxnReader
- type TxnState
- type TxnStatus
- type TxnStore
- type TxnTest
- type TxnType
- type TxnUnsafe
- type TxnWriter
Constants ¶
View Source
const ( FreezePhase = "Phase_Freeze" RollbackPhase = "Phase_Rollback" PrePreparePhase = "Phase_PrePrepare" PrepareCommitPhase = "Phase_PrepareCommit" PreApplyCommitPhase = "Phase_PreApplyCommit" ApplyCommitPhase = "Phase_ApplyCommit" )
View Source
const ( TxnType_Normal = iota TxnType_Heartbeat )
Variables ¶
View Source
var (
ErrTxnWWConflict = moerr.NewTxnWWConflictNoCtx()
)
View Source
var UncommitTS types.TS
Functions ¶
func RegisterCmdFactory ¶
func RegisterCmdFactory(cmdType int16, factory CmdFactory)
func TxnStrState ¶
Types ¶
type AppendNode ¶
type AppendNode interface { BaseMVCCNode TxnEntry GetStartRow() uint32 GetMaxRow() uint32 }
type AsyncTxn ¶
type AsyncTxn interface { TxnUnsafe TxnTest Txn2PC TxnHandle TxnAsyncer TxnReader TxnWriter TxnChanger }
type BaseMVCCNode ¶ added in v0.8.0
type BaseMVCCNode interface { String() string IsNil() bool IsVisibleByTS(ts types.TS) (visible bool) IsVisible(txn TxnReader) (visible bool) CheckConflict(txn TxnReader) error PreparedIn(minTS, maxTS types.TS) (in, before bool) CommittedIn(minTS, maxTS types.TS) (in, before bool) NeedWaitCommitting(ts types.TS) (bool, TxnReader) IsSameTxn(txn TxnReader) bool IsActive() bool IsCommitting() bool IsCommitted() bool IsAborted() bool Set1PC() Is1PC() bool GetEnd() types.TS GetStart() types.TS GetPrepare() types.TS GetTxn() TxnReader ApplyCommit() (err error) ApplyRollback() (err error) PrepareCommit() (err error) PrepareRollback() (err error) WriteTo(w io.Writer) (n int64, err error) ReadFrom(r io.Reader) (n int64, err error) }
type BaseNode ¶ added in v0.8.0
type BaseNode[T any] interface { Update(o T) CloneData() T CloneAll() T }
type CmdFactory ¶
func GetCmdFactory ¶
func GetCmdFactory(cmdType int16) (factory CmdFactory)
type DeleteChain ¶
type DeleteChain interface { sync.Locker RLock() RUnlock() RemoveNodeLocked(DeleteNode) AddNodeLocked(txn AsyncTxn, deleteType handle.DeleteType) DeleteNode AddMergeNode() DeleteNode PrepareRangeDelete(start, end uint32, ts types.TS) error DepthLocked() int CollectDeletesLocked(txn TxnReader, rwlocker *sync.RWMutex) (*nulls.Bitmap, error) }
type DeleteNode ¶
type MVCCNode ¶ added in v0.6.0
type MVCCNode[T any] interface { BaseMVCCNode BaseNode[T] }
type TxnAsyncer ¶
type TxnChanger ¶
type TxnChanger interface { sync.Locker RLock() RUnlock() ToCommittedLocked() error ToPreparingLocked(ts types.TS) error ToPrepared() error ToPreparedLocked() error ToRollbackedLocked() error ToRollbacking(ts types.TS) error ToRollbackingLocked(ts types.TS) error ToUnknownLocked() Prepare(ctx context.Context) (types.TS, error) Committing() error Commit(ctx context.Context) error Rollback(ctx context.Context) error SetCommitTS(cts types.TS) error SetDedupType(skip DedupType) SetParticipants(ids []uint64) error SetError(error) CommittingInRecovery() error CommitInRecovery(ctx context.Context) error }
type TxnEntryType ¶
type TxnEntryType int16
type TxnHandle ¶
type TxnHandle interface { BindAccessInfo(tenantID, userID, roleID uint32) GetTenantID() uint32 GetUserAndRoleID() (uint32, uint32) CreateDatabase(name, createSql, datTyp string) (handle.Database, error) CreateDatabaseWithCtx(ctx context.Context, name, createSql, datTyp string, id uint64) (handle.Database, error) DropDatabase(name string) (handle.Database, error) DropDatabaseByID(id uint64) (handle.Database, error) GetDatabase(name string) (handle.Database, error) GetDatabaseWithCtx(ctx context.Context, name string) (handle.Database, error) GetDatabaseByID(id uint64) (handle.Database, error) DatabaseNames() []string }
type TxnMemo ¶ added in v0.6.0
func NewTxnMemo ¶ added in v0.6.0
func NewTxnMemo() *TxnMemo
func (*TxnMemo) AddCatalogChange ¶ added in v0.6.0
func (memo *TxnMemo) AddCatalogChange()
func (*TxnMemo) GetDirtyTableByID ¶ added in v0.6.0
func (*TxnMemo) HasAnyTableDataChanges ¶ added in v0.6.0
func (*TxnMemo) HasCatalogChanges ¶ added in v0.6.0
func (*TxnMemo) HasTableDataChanges ¶ added in v0.6.0
type TxnReader ¶
type TxnReader interface { RLock() RUnlock() IsReplay() bool Is2PC() bool GetDedupType() DedupType GetID() string GetCtx() []byte GetStartTS() types.TS GetCommitTS() types.TS GetContext() context.Context GetPrepareTS() types.TS GetParticipants() []uint64 GetSnapshotTS() types.TS SetSnapshotTS(types.TS) HasSnapshotLag() bool IsVisible(o TxnReader) bool GetTxnState(waitIfcommitting bool) TxnState GetError() error GetStore() TxnStore String() string Repr() string GetLSN() uint64 GetMemo() *TxnMemo SameTxn(txn TxnReader) bool CommitBefore(startTs types.TS) bool CommitAfter(startTs types.TS) bool }
type TxnState ¶
type TxnState int32
const ( TxnStateActive TxnState = iota TxnStatePreparing //TxnStatePrepared only for 2PC TxnStatePrepared //TxnStateCommittingFinished only for 2PC txn runs on coordinator TxnStateCommittingFinished TxnStateRollbacking //TxnStateCommitted , TxnStateRollbacked, and TxnStateUnknown are final states. TxnStateCommitted TxnStateRollbacked TxnStateUnknown )
type TxnStore ¶
type TxnStore interface { io.Closer Txn2PC TxnUnsafe WaitPrepared(ctx context.Context) error BindTxn(AsyncTxn) GetLSN() uint64 GetContext() context.Context BatchDedup(dbId, id uint64, pk containers.Vector) error Append(ctx context.Context, dbId, id uint64, data *containers.Batch) error AddBlksWithMetaLoc(ctx context.Context, dbId, id uint64, metaLocs []objectio.Location) error RangeDelete(id *common.ID, start, end uint32, dt handle.DeleteType) error GetByFilter(ctx context.Context, dbId uint64, id uint64, filter *handle.Filter) (*common.ID, uint32, error) GetValue(id *common.ID, row uint32, col uint16) (any, bool, error) CreateRelation(dbId uint64, def any) (handle.Relation, error) CreateRelationWithTableId(dbId uint64, tableId uint64, def any) (handle.Relation, error) DropRelationByName(dbId uint64, name string) (handle.Relation, error) DropRelationByID(dbId uint64, tid uint64) (handle.Relation, error) GetRelationByName(dbId uint64, name string) (handle.Relation, error) GetRelationByID(dbId uint64, tid uint64) (handle.Relation, error) CreateDatabase(name, createSql, datTyp string) (handle.Database, error) CreateDatabaseWithID(name, createSql, datTyp string, id uint64) (handle.Database, error) GetDatabase(name string) (handle.Database, error) GetDatabaseByID(id uint64) (handle.Database, error) DropDatabase(name string) (handle.Database, error) DropDatabaseByID(id uint64) (handle.Database, error) DatabaseNames() []string GetSegment(id *common.ID) (handle.Segment, error) CreateSegment(dbId, tid uint64, is1PC bool) (handle.Segment, error) CreateNonAppendableSegment(dbId, tid uint64, is1PC bool) (handle.Segment, error) CreateBlock(id *common.ID, is1PC bool) (handle.Block, error) GetBlock(id *common.ID) (handle.Block, error) CreateNonAppendableBlock(id *common.ID, opts *objectio.CreateBlockOpt) (handle.Block, error) SoftDeleteSegment(id *common.ID) error SoftDeleteBlock(id *common.ID) error UpdateMetaLoc(id *common.ID, metaLoc objectio.Location) (err error) UpdateDeltaLoc(id *common.ID, deltaLoc objectio.Location) (err error) AddTxnEntry(TxnEntryType, TxnEntry) LogTxnEntry(dbId, tableId uint64, entry TxnEntry, readed []*common.ID) error LogTxnState(sync bool) (entry.Entry, error) DoneWaitEvent(cnt int) AddWaitEvent(cnt int) IsReadonly() bool IncreateWriteCnt() int ObserveTxn( visitDatabase func(db any), visitTable func(tbl any), rotateTable func(dbName, tblName string, dbid, tid uint64), visitMetadata func(block any), visitSegment func(seg any), visitAppend func(bat any), visitDelete func(ctx context.Context, deletes DeleteNode)) GetTransactionType() TxnType }
Click to show internal directories.
Click to hide internal directories.