updates

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendNode

type AppendNode struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func MockAppendNode

func MockAppendNode(ts uint64, maxRow uint32, mvcc *MVCCHandle) *AppendNode

func NewAppendNode

func NewAppendNode(txn txnif.AsyncTxn, maxRow uint32, mvcc *MVCCHandle) *AppendNode

func NewCommittedAppendNode

func NewCommittedAppendNode(ts uint64, maxRow uint32, mvcc *MVCCHandle) *AppendNode

func (*AppendNode) ApplyCommit

func (node *AppendNode) ApplyCommit(index *wal.Index) error

func (*AppendNode) ApplyRollback

func (node *AppendNode) ApplyRollback() (err error)

func (*AppendNode) GeneralDesc

func (node *AppendNode) GeneralDesc() string

func (*AppendNode) GeneralString

func (node *AppendNode) GeneralString() string

func (*AppendNode) GeneralVerboseString

func (node *AppendNode) GeneralVerboseString() string

func (*AppendNode) GetCommitTS

func (node *AppendNode) GetCommitTS() uint64

func (*AppendNode) GetID

func (node *AppendNode) GetID() *common.ID

func (*AppendNode) GetMaxRow

func (node *AppendNode) GetMaxRow() uint32

func (*AppendNode) MakeCommand

func (node *AppendNode) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*AppendNode) PrepareCommit

func (node *AppendNode) PrepareCommit() error

func (*AppendNode) PrepareRollback

func (node *AppendNode) PrepareRollback() (err error)

func (*AppendNode) ReadFrom

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

func (*AppendNode) SetLogIndex

func (node *AppendNode) SetLogIndex(idx *wal.Index)

func (*AppendNode) SetMaxRow

func (node *AppendNode) SetMaxRow(row uint32)

func (*AppendNode) WriteTo

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

type ColumnChain

type ColumnChain struct {
	*common.Link
	*sync.RWMutex
	// contains filtered or unexported fields
}

func MockColumnUpdateChain

func MockColumnUpdateChain() *ColumnChain

func NewColumnChain

func NewColumnChain(rwlocker *sync.RWMutex, colIdx uint16, mvcc *MVCCHandle) *ColumnChain

func (*ColumnChain) AddNode

func (chain *ColumnChain) AddNode(txn txnif.AsyncTxn) txnif.UpdateNode

func (*ColumnChain) AddNodeLocked

func (chain *ColumnChain) AddNodeLocked(txn txnif.AsyncTxn) txnif.UpdateNode

func (*ColumnChain) CollectCommittedInRangeLocked

func (chain *ColumnChain) CollectCommittedInRangeLocked(startTs, endTs uint64) (mask *roaring.Bitmap, vals map[uint32]any, indexes []*wal.Index, err error)

func (*ColumnChain) CollectUpdatesLocked

func (chain *ColumnChain) CollectUpdatesLocked(ts uint64) (*roaring.Bitmap, map[uint32]any, error)

func (*ColumnChain) DeleteNode

func (chain *ColumnChain) DeleteNode(node *common.DLNode)

func (*ColumnChain) DeleteNodeLocked

func (chain *ColumnChain) DeleteNodeLocked(node *common.DLNode)

func (*ColumnChain) DepthLocked

func (chain *ColumnChain) DepthLocked() int

func (*ColumnChain) GetBlockID

func (chain *ColumnChain) GetBlockID() *common.ID

func (*ColumnChain) GetColumnIdx

func (chain *ColumnChain) GetColumnIdx() uint16

func (*ColumnChain) GetColumnName

func (chain *ColumnChain) GetColumnName() string

func (*ColumnChain) GetController

func (chain *ColumnChain) GetController() *MVCCHandle

func (*ColumnChain) GetID

func (chain *ColumnChain) GetID() *common.ID

func (*ColumnChain) GetMeta

func (chain *ColumnChain) GetMeta() *catalog.BlockEntry

func (*ColumnChain) GetValueLocked

func (chain *ColumnChain) GetValueLocked(row uint32, ts uint64) (v any, err error)

func (*ColumnChain) LoadUpdateCnt

func (chain *ColumnChain) LoadUpdateCnt() uint32

func (*ColumnChain) LoopChainLocked

func (chain *ColumnChain) LoopChainLocked(fn func(col *ColumnUpdateNode) bool, reverse bool)

func (*ColumnChain) OnReplayUpdateNode

func (chain *ColumnChain) OnReplayUpdateNode(updateNode txnif.UpdateNode)

func (*ColumnChain) PrepareUpdate

func (chain *ColumnChain) PrepareUpdate(row uint32, n txnif.UpdateNode) error

func (*ColumnChain) SetUpdateCnt

func (chain *ColumnChain) SetUpdateCnt(cnt uint32)

func (*ColumnChain) StringLocked

func (chain *ColumnChain) StringLocked() string

func (*ColumnChain) TryUpdateNodeLocked

func (chain *ColumnChain) TryUpdateNodeLocked(row uint32, v any, n txnif.UpdateNode) (err error)

func (*ColumnChain) UpdateLocked

func (chain *ColumnChain) UpdateLocked(node *ColumnUpdateNode)

type ColumnUpdateNode

type ColumnUpdateNode struct {
	*common.DLNode
	*sync.RWMutex
	// contains filtered or unexported fields
}

func NewColumnUpdateNode

func NewColumnUpdateNode(txn txnif.AsyncTxn, id *common.ID, rwlocker *sync.RWMutex) *ColumnUpdateNode

func NewCommittedColumnUpdateNode

func NewCommittedColumnUpdateNode(startTs, commitTs uint64, id *common.ID, rwlocker *sync.RWMutex) *ColumnUpdateNode

func NewSimpleColumnUpdateNode

func NewSimpleColumnUpdateNode() *ColumnUpdateNode

func (*ColumnUpdateNode) ApplyCommit

func (node *ColumnUpdateNode) ApplyCommit(index *wal.Index) (err error)

func (*ColumnUpdateNode) ApplyRollback

func (node *ColumnUpdateNode) ApplyRollback() (err error)

func (*ColumnUpdateNode) ApplyToColumn

func (node *ColumnUpdateNode) ApplyToColumn(vec containers.Vector, deletes *roaring.Bitmap) containers.Vector

func (*ColumnUpdateNode) AttachTo

func (node *ColumnUpdateNode) AttachTo(chain *ColumnChain)

func (*ColumnUpdateNode) Compare

func (node *ColumnUpdateNode) Compare(o common.NodePayload) int

func (*ColumnUpdateNode) EqualLocked

func (node *ColumnUpdateNode) EqualLocked(o *ColumnUpdateNode) bool

func (*ColumnUpdateNode) GeneralDesc

func (node *ColumnUpdateNode) GeneralDesc() string

func (*ColumnUpdateNode) GeneralString

func (node *ColumnUpdateNode) GeneralString() string

func (*ColumnUpdateNode) GeneralVerboseString

func (node *ColumnUpdateNode) GeneralVerboseString() string

func (*ColumnUpdateNode) GetChain

func (node *ColumnUpdateNode) GetChain() txnif.UpdateChain

func (*ColumnUpdateNode) GetCommitTSLocked

func (node *ColumnUpdateNode) GetCommitTSLocked() uint64

func (*ColumnUpdateNode) GetDLNode

func (node *ColumnUpdateNode) GetDLNode() *common.DLNode

func (*ColumnUpdateNode) GetID

func (node *ColumnUpdateNode) GetID() *common.ID

func (*ColumnUpdateNode) GetMask

func (node *ColumnUpdateNode) GetMask() *roaring.Bitmap

func (*ColumnUpdateNode) GetStartTS

func (node *ColumnUpdateNode) GetStartTS() uint64

func (*ColumnUpdateNode) GetUpdateCntLocked

func (node *ColumnUpdateNode) GetUpdateCntLocked() int

func (*ColumnUpdateNode) GetValueLocked

func (node *ColumnUpdateNode) GetValueLocked(row uint32) (v any, err error)

func (*ColumnUpdateNode) GetValues

func (node *ColumnUpdateNode) GetValues() map[uint32]any

func (*ColumnUpdateNode) MakeCommand

func (node *ColumnUpdateNode) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*ColumnUpdateNode) MergeLocked

func (node *ColumnUpdateNode) MergeLocked(o *ColumnUpdateNode)

func (*ColumnUpdateNode) PrepareCommit

func (node *ColumnUpdateNode) PrepareCommit() (err error)

func (*ColumnUpdateNode) PrepareRollback

func (node *ColumnUpdateNode) PrepareRollback() (err error)

func (*ColumnUpdateNode) ReadFrom

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

ReadFrom TODO: rewrite

func (*ColumnUpdateNode) SetLogIndex

func (node *ColumnUpdateNode) SetLogIndex(idx *wal.Index)

func (*ColumnUpdateNode) SetMask

func (node *ColumnUpdateNode) SetMask(mask *roaring.Bitmap)

func (*ColumnUpdateNode) SetValues

func (node *ColumnUpdateNode) SetValues(vals map[uint32]any)

func (*ColumnUpdateNode) String

func (node *ColumnUpdateNode) String() string

func (*ColumnUpdateNode) StringLocked

func (node *ColumnUpdateNode) StringLocked() string

func (*ColumnUpdateNode) UpdateLocked

func (node *ColumnUpdateNode) UpdateLocked(row uint32, v any) error

func (*ColumnUpdateNode) WriteTo

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

type ColumnView

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

func NewColumnView

func NewColumnView() *ColumnView

func (*ColumnView) CollectUpdates

func (view *ColumnView) CollectUpdates(ts uint64) (mask *roaring.Bitmap, vals map[uint32]any, err error)

func (*ColumnView) Delete

func (view *ColumnView) Delete(key uint32, n *ColumnUpdateNode) (err error)

func (*ColumnView) GetValue

func (view *ColumnView) GetValue(key uint32, startTs uint64) (v any, err error)

func (*ColumnView) Insert

func (view *ColumnView) Insert(key uint32, un txnif.UpdateNode) (err error)

func (*ColumnView) PrepapreInsert

func (view *ColumnView) PrepapreInsert(key uint32, ts uint64) (err error)

func (*ColumnView) RowCnt

func (view *ColumnView) RowCnt() int

func (*ColumnView) RowStringLocked

func (view *ColumnView) RowStringLocked(row uint32, link *common.Link) string

func (*ColumnView) StringLocked

func (view *ColumnView) StringLocked() string

type DeleteChain

type DeleteChain struct {
	*sync.RWMutex
	*common.Link
	// contains filtered or unexported fields
}

func NewDeleteChain

func NewDeleteChain(rwlocker *sync.RWMutex, mvcc *MVCCHandle) *DeleteChain

func (*DeleteChain) AddDeleteCnt

func (chain *DeleteChain) AddDeleteCnt(cnt uint32)

func (*DeleteChain) AddMergeNode

func (chain *DeleteChain) AddMergeNode() txnif.DeleteNode

func (*DeleteChain) AddNodeLocked

func (chain *DeleteChain) AddNodeLocked(txn txnif.AsyncTxn, deleteType handle.DeleteType) txnif.DeleteNode

func (*DeleteChain) CollectDeletesInRange

func (chain *DeleteChain) CollectDeletesInRange(
	startTs, endTs uint64,
	rwlocker *sync.RWMutex) (mask *roaring.Bitmap, indexes []*wal.Index, err error)

CollectDeletesInRange collects [startTs, endTs)

func (*DeleteChain) CollectDeletesLocked

func (chain *DeleteChain) CollectDeletesLocked(
	ts uint64,
	collectIndex bool,
	rwlocker *sync.RWMutex) (txnif.DeleteNode, error)

func (*DeleteChain) DepthLocked

func (chain *DeleteChain) DepthLocked() int

func (*DeleteChain) GetController

func (chain *DeleteChain) GetController() *MVCCHandle

func (*DeleteChain) GetDeleteCnt

func (chain *DeleteChain) GetDeleteCnt() uint32

func (*DeleteChain) IsDeleted

func (chain *DeleteChain) IsDeleted(row uint32, ts uint64, rwlocker *sync.RWMutex) (deleted bool, err error)

func (*DeleteChain) LoopChainLocked

func (chain *DeleteChain) LoopChainLocked(fn func(node *DeleteNode) bool, reverse bool)

func (*DeleteChain) OnReplayNode

func (chain *DeleteChain) OnReplayNode(deleteNode *DeleteNode)

func (*DeleteChain) PrepareRangeDelete

func (chain *DeleteChain) PrepareRangeDelete(start, end uint32, ts uint64) (err error)

func (*DeleteChain) RemoveNodeLocked

func (chain *DeleteChain) RemoveNodeLocked(node txnif.DeleteNode)

func (*DeleteChain) StringLocked

func (chain *DeleteChain) StringLocked() string

func (*DeleteChain) UpdateLocked

func (chain *DeleteChain) UpdateLocked(node *DeleteNode)

type DeleteNode

type DeleteNode struct {
	*sync.RWMutex
	*common.DLNode
	// contains filtered or unexported fields
}

func NewDeleteNode

func NewDeleteNode(txn txnif.AsyncTxn, dt handle.DeleteType) *DeleteNode

func NewMergedNode

func NewMergedNode(commitTs uint64) *DeleteNode

func (*DeleteNode) AddLogIndexLocked

func (node *DeleteNode) AddLogIndexLocked(index *wal.Index)

func (*DeleteNode) AddLogIndexesLocked

func (node *DeleteNode) AddLogIndexesLocked(indexes []*wal.Index)

func (*DeleteNode) ApplyCommit

func (node *DeleteNode) ApplyCommit(index *wal.Index) (err error)

func (*DeleteNode) ApplyRollback

func (node *DeleteNode) ApplyRollback() (err error)

func (*DeleteNode) AttachTo

func (node *DeleteNode) AttachTo(chain *DeleteChain)

func (*DeleteNode) Compare

func (node *DeleteNode) Compare(o common.NodePayload) int

func (*DeleteNode) GeneralDesc

func (node *DeleteNode) GeneralDesc() string

func (*DeleteNode) GeneralString

func (node *DeleteNode) GeneralString() string

func (*DeleteNode) GeneralVerboseString

func (node *DeleteNode) GeneralVerboseString() string

func (*DeleteNode) GetCardinalityLocked

func (node *DeleteNode) GetCardinalityLocked() uint32

func (*DeleteNode) GetChain

func (node *DeleteNode) GetChain() txnif.DeleteChain

func (*DeleteNode) GetCommitTSLocked

func (node *DeleteNode) GetCommitTSLocked() uint64

func (*DeleteNode) GetDeleteMaskLocked

func (node *DeleteNode) GetDeleteMaskLocked() *roaring.Bitmap

func (*DeleteNode) GetID

func (node *DeleteNode) GetID() *common.ID

func (*DeleteNode) GetRowMaskRefLocked

func (node *DeleteNode) GetRowMaskRefLocked() *roaring.Bitmap

func (*DeleteNode) GetStartTS

func (node *DeleteNode) GetStartTS() uint64

func (*DeleteNode) HasOverlapLocked

func (node *DeleteNode) HasOverlapLocked(start, end uint32) bool

func (*DeleteNode) IsDeletedLocked

func (node *DeleteNode) IsDeletedLocked(row uint32) bool

func (*DeleteNode) IsMerged

func (node *DeleteNode) IsMerged() bool

func (*DeleteNode) MakeCommand

func (node *DeleteNode) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*DeleteNode) MergeLocked

func (node *DeleteNode) MergeLocked(o *DeleteNode, collectIndex bool)

func (*DeleteNode) OnApply

func (node *DeleteNode) OnApply() (err error)

func (*DeleteNode) PrepareCommit

func (node *DeleteNode) PrepareCommit() (err error)

func (*DeleteNode) PrepareRollback

func (node *DeleteNode) PrepareRollback() (err error)

func (*DeleteNode) RangeDeleteLocked

func (node *DeleteNode) RangeDeleteLocked(start, end uint32)

func (*DeleteNode) ReadFrom

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

func (*DeleteNode) SetDeletes

func (node *DeleteNode) SetDeletes(mask *roaring.Bitmap)

func (*DeleteNode) SetLogIndex

func (node *DeleteNode) SetLogIndex(idx *wal.Index)

func (*DeleteNode) StringLocked

func (node *DeleteNode) StringLocked() string

func (*DeleteNode) WriteTo

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

type MVCCHandle

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

func NewMVCCHandle

func NewMVCCHandle(meta *catalog.BlockEntry) *MVCCHandle

func (*MVCCHandle) AddAppendNodeLocked

func (n *MVCCHandle) AddAppendNodeLocked(txn txnif.AsyncTxn, maxRow uint32) *AppendNode

func (*MVCCHandle) AddHoles added in v0.5.1

func (n *MVCCHandle) AddHoles(start, end int)

func (*MVCCHandle) CheckNotDeleted

func (n *MVCCHandle) CheckNotDeleted(start, end uint32, ts uint64) error

func (*MVCCHandle) CheckNotUpdated

func (n *MVCCHandle) CheckNotUpdated(start, end uint32, ts uint64) (err error)

func (*MVCCHandle) CollectAppendLogIndexesLocked

func (n *MVCCHandle) CollectAppendLogIndexesLocked(startTs, endTs uint64) (indexes []*wal.Index, err error)

func (*MVCCHandle) CreateDeleteNode

func (n *MVCCHandle) CreateDeleteNode(txn txnif.AsyncTxn, deleteType handle.DeleteType) txnif.DeleteNode

func (*MVCCHandle) CreateUpdateNode

func (n *MVCCHandle) CreateUpdateNode(colIdx uint16, txn txnif.AsyncTxn) txnif.UpdateNode

func (*MVCCHandle) DropUpdateNode

func (n *MVCCHandle) DropUpdateNode(colIdx uint16, node txnif.UpdateNode)

func (*MVCCHandle) GetChangeNodeCnt

func (n *MVCCHandle) GetChangeNodeCnt() uint32

func (*MVCCHandle) GetColumnChain

func (n *MVCCHandle) GetColumnChain(colIdx uint16) *ColumnChain

func (*MVCCHandle) GetColumnExclusiveLock

func (n *MVCCHandle) GetColumnExclusiveLock(idx uint16) sync.Locker

func (*MVCCHandle) GetColumnUpdateCnt

func (n *MVCCHandle) GetColumnUpdateCnt(colIdx uint16) uint32

func (*MVCCHandle) GetDeleteChain

func (n *MVCCHandle) GetDeleteChain() *DeleteChain

func (*MVCCHandle) GetDeleteCnt

func (n *MVCCHandle) GetDeleteCnt() uint32

func (*MVCCHandle) GetDeletesListener

func (n *MVCCHandle) GetDeletesListener() func(uint64, common.RowGen, uint64) error

func (*MVCCHandle) GetID

func (n *MVCCHandle) GetID() *common.ID

func (*MVCCHandle) GetMaxVisibleRowLocked

func (n *MVCCHandle) GetMaxVisibleRowLocked(ts uint64) (row uint32, visible bool, err error)

func (*MVCCHandle) GetTotalRow

func (n *MVCCHandle) GetTotalRow() uint32

GetTotalRow is only for replay

func (*MVCCHandle) HasActiveAppendNode

func (n *MVCCHandle) HasActiveAppendNode() bool

func (*MVCCHandle) HasHole added in v0.5.1

func (n *MVCCHandle) HasHole() bool

func (*MVCCHandle) HoleCnt added in v0.5.1

func (n *MVCCHandle) HoleCnt() int

func (*MVCCHandle) IncChangeNodeCnt

func (n *MVCCHandle) IncChangeNodeCnt()

func (*MVCCHandle) IsDeletedLocked

func (n *MVCCHandle) IsDeletedLocked(row uint32, ts uint64, rwlocker *sync.RWMutex) (bool, error)

func (*MVCCHandle) IsVisibleLocked

func (n *MVCCHandle) IsVisibleLocked(row uint32, ts uint64) (bool, error)

func (*MVCCHandle) LoadMaxVisible

func (n *MVCCHandle) LoadMaxVisible() uint64

func (*MVCCHandle) OnReplayAppendNode

func (n *MVCCHandle) OnReplayAppendNode(an *AppendNode)

func (*MVCCHandle) OnReplayDeleteNode

func (n *MVCCHandle) OnReplayDeleteNode(deleteNode txnif.DeleteNode)

func (*MVCCHandle) PrepareUpdate

func (n *MVCCHandle) PrepareUpdate(row uint32, colIdx uint16, update txnif.UpdateNode) error

func (*MVCCHandle) ResetChangeNodeCnt

func (n *MVCCHandle) ResetChangeNodeCnt()

func (*MVCCHandle) SetDeletesListener

func (n *MVCCHandle) SetDeletesListener(l func(uint64, common.RowGen, uint64) error)

func (*MVCCHandle) SetMaxVisible

func (n *MVCCHandle) SetMaxVisible(ts uint64)

func (*MVCCHandle) StringLocked

func (n *MVCCHandle) StringLocked() string

func (*MVCCHandle) TrySetMaxVisible

func (n *MVCCHandle) TrySetMaxVisible(ts uint64)

type NodeType

type NodeType int8
const (
	NT_Normal NodeType = iota
	NT_Merge
)

type UpdateCmd

type UpdateCmd struct {
	*txnbase.BaseCustomizedCmd
	// contains filtered or unexported fields
}

func NewAppendCmd

func NewAppendCmd(id uint32, app *AppendNode) *UpdateCmd

func NewDeleteCmd

func NewDeleteCmd(id uint32, del *DeleteNode) *UpdateCmd

func NewEmptyCmd

func NewEmptyCmd(cmdType int16) *UpdateCmd

func NewUpdateCmd

func NewUpdateCmd(id uint32, update *ColumnUpdateNode) *UpdateCmd

func (*UpdateCmd) Desc

func (c *UpdateCmd) Desc() string

func (*UpdateCmd) GetAppendNode

func (c *UpdateCmd) GetAppendNode() *AppendNode

func (*UpdateCmd) GetDBID

func (c *UpdateCmd) GetDBID() uint64

func (*UpdateCmd) GetDeleteNode

func (c *UpdateCmd) GetDeleteNode() *DeleteNode

func (*UpdateCmd) GetDest

func (c *UpdateCmd) GetDest() *common.ID

func (*UpdateCmd) GetType

func (c *UpdateCmd) GetType() int16

func (*UpdateCmd) GetUpdateNode

func (c *UpdateCmd) GetUpdateNode() *ColumnUpdateNode

func (*UpdateCmd) Marshal

func (c *UpdateCmd) Marshal() (buf []byte, err error)

func (*UpdateCmd) ReadFrom

func (c *UpdateCmd) ReadFrom(r io.Reader) (n int64, err error)

func (*UpdateCmd) String

func (c *UpdateCmd) String() string

func (*UpdateCmd) Unmarshal

func (c *UpdateCmd) Unmarshal(buf []byte) error

func (*UpdateCmd) VerboseString

func (c *UpdateCmd) VerboseString() string

func (*UpdateCmd) WriteTo

func (c *UpdateCmd) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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