Documentation ¶
Index ¶
- Constants
- Variables
- func EvalSelectedOnFixedSizeColumnFactory[T types.FixedSizeTExceptStrType](v T) func(*vector.Vector, []int32, *[]int32)
- func EvalSelectedOnFixedSizeSortedColumnFactory[T types.FixedSizeTExceptStrType](v T, comp func(T, T) int) func(*vector.Vector, []int32, *[]int32)
- func EvalSelectedOnOrderedSortedColumnFactory[T types.OrderedT](v T) func(*vector.Vector, []int32, *[]int32)
- func EvalSelectedOnVarlenColumnFactory(v []byte) func(*vector.Vector, []int32, *[]int32)
- func EvalSelectedOnVarlenSortedColumnFactory(v []byte) func(*vector.Vector, []int32, *[]int32)
- func GetTableDef(ctx context.Context, table engine.Relation, dbName, tableName string, ...) (*plan2.ObjectRef, *plan2.TableDef)
- func NewMergeReader(readers []engine.Reader) *mergeReader
- func SelectForCommonTenant(selector clusterservice.Selector, filter func(string) bool, ...)
- func SelectForSuperTenant(selector clusterservice.Selector, username string, filter func(string) bool, ...)
- func UpdateStats(ctx context.Context, tbl *txnTable, s *plan2.StatsInfoMap) bool
- func UpdateStatsForPartitionTable(ctx context.Context, baseTable *txnTable, partitionTables []any, ...) bool
- type DNStore
- type Engine
- func (e *Engine) AllocateIDByKey(ctx context.Context, key string) (uint64, error)
- func (e *Engine) Create(ctx context.Context, name string, op client.TxnOperator) error
- func (e *Engine) Database(ctx context.Context, name string, op client.TxnOperator) (engine.Database, error)
- func (e *Engine) Databases(ctx context.Context, op client.TxnOperator) ([]string, error)
- func (e *Engine) Delete(ctx context.Context, name string, op client.TxnOperator) error
- func (e *Engine) GetNameById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, err error)
- func (e *Engine) GetRelationById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName, tableName string, rel engine.Relation, err error)
- func (e *Engine) Hints() (h engine.Hints)
- func (e *Engine) InitLogTailPushModel(ctx context.Context, timestampWaiter client.TimestampWaiter) error
- func (e *Engine) New(ctx context.Context, op client.TxnOperator) error
- func (e *Engine) NewBlockReader(ctx context.Context, num int, ts timestamp.Timestamp, expr *plan.Expr, ...) ([]engine.Reader, error)
- func (e *Engine) Nodes(isInternal bool, tenant string, username string, cnLabel map[string]string) (engine.Nodes, error)
- func (e *Engine) UpdateOfPull(ctx context.Context, tnList []DNStore, tbl *txnTable, op client.TxnOperator, ...) error
- func (e *Engine) UpdateOfPush(ctx context.Context, databaseId, tableId uint64, ts timestamp.Timestamp) error
- type Entry
- type IDGenerator
- type PartitionReader
- type Pos
- type Transaction
- func (txn *Transaction) Adjust() error
- func (txn *Transaction) Commit(ctx context.Context) ([]txn.TxnRequest, error)
- func (txn *Transaction) EndStatement()
- func (txn *Transaction) GetSQLCount() uint64
- func (txn *Transaction) IncrSQLCount()
- func (txn *Transaction) IncrStatementID(ctx context.Context, commit bool) error
- func (txn *Transaction) PutCnBlockDeletes(blockId *types.Blockid, offsets []int64)
- func (txn *Transaction) ReadOnly() bool
- func (txn *Transaction) Rollback(ctx context.Context) error
- func (txn *Transaction) RollbackLastStatement(ctx context.Context) error
- func (txn *Transaction) StartStatement()
- func (txn *Transaction) WriteBatch(typ int, databaseId uint64, tableId uint64, databaseName string, ...) error
- func (txn *Transaction) WriteFile(typ int, databaseId, tableId uint64, databaseName, tableName string, ...) error
- func (txn *Transaction) WriteFileLocked(typ int, databaseId, tableId uint64, databaseName, tableName string, ...) error
Constants ¶
const ( PREFETCH_THRESHOLD = 128 PREFETCH_ROUNDS = 16 )
const ( INSERT = iota DELETE COMPACTION_CN UPDATE ALTER )
const ( MO_DATABASE_ID_NAME_IDX = 1 MO_DATABASE_ID_ACCOUNT_IDX = 2 MO_DATABASE_LIST_ACCOUNT_IDX = 1 MO_TABLE_ID_NAME_IDX = 1 MO_TABLE_ID_DATABASE_ID_IDX = 2 MO_TABLE_ID_ACCOUNT_IDX = 3 MO_TABLE_LIST_DATABASE_ID_IDX = 1 MO_TABLE_LIST_ACCOUNT_IDX = 2 MO_PRIMARY_OFF = 2 INIT_ROWID_OFFSET = math.MaxUint32 )
const ( HASH_VALUE_FUN string = "hash_value" MAX_RANGE_SIZE int64 = 200 )
const (
AllColumns = "*"
)
const (
WorkspaceThreshold uint64 = 1 * mpool.MB
)
Variables ¶
var GcCycle = 10 * time.Second
Functions ¶
func EvalSelectedOnFixedSizeColumnFactory ¶ added in v0.8.0
func EvalSelectedOnFixedSizeColumnFactory[T types.FixedSizeTExceptStrType]( v T, ) func(*vector.Vector, []int32, *[]int32)
2.1 fixedSize type column + non-sorted
func EvalSelectedOnFixedSizeSortedColumnFactory ¶ added in v0.8.0
func EvalSelectedOnFixedSizeSortedColumnFactory[T types.FixedSizeTExceptStrType]( v T, comp func(T, T) int, ) func(*vector.Vector, []int32, *[]int32)
1.2 fixed size column type + sorted column
func EvalSelectedOnOrderedSortedColumnFactory ¶ added in v0.8.0
func EvalSelectedOnOrderedSortedColumnFactory[T types.OrderedT]( v T, ) func(*vector.Vector, []int32, *[]int32)
1.1 ordered column type + sorted column
func EvalSelectedOnVarlenColumnFactory ¶ added in v0.8.0
2.2 varlen type column + non-sorted
func EvalSelectedOnVarlenSortedColumnFactory ¶ added in v0.8.0
1.3 varlen type column + sorted
func GetTableDef ¶ added in v1.0.0
func GetTableDef(ctx context.Context, table engine.Relation, dbName, tableName string, sub *plan.SubscriptionMeta) (*plan2.ObjectRef, *plan2.TableDef)
GetTableDef Get the complete `plan.TableDef` of the table based on the engine.Relation instance. Note: Through the `Relation(*txnTable).getTableDef()` The `plan.TableDef` obtained is incomplete, and may lose some key information, such as constraints. It is recommended to use it with caution
func NewMergeReader ¶ added in v0.8.0
func SelectForCommonTenant ¶ added in v0.8.0
func SelectForCommonTenant( selector clusterservice.Selector, filter func(string) bool, appendFn func(service *metadata.CNService), )
SelectForCommonTenant selects CN services for common tenant. If there are CN services for the selector, just select them, else, return CN services with empty labels if there are any.
func SelectForSuperTenant ¶ added in v0.8.0
func SelectForSuperTenant( selector clusterservice.Selector, username string, filter func(string) bool, appendFn func(service *metadata.CNService), )
SelectForSuperTenant is used to select CN servers for sys tenant. For sys tenant, there are some special strategies to select CN servers. First of all, the requested labels must be match with the ones on servers. Then, the following strategies are listed in order of priority:
- The CN servers which are configured as sys account.
- The CN servers which are configured as some labels whose key is not account.
- The CN servers which are configured as no labels.
- At last, if no CN servers are selected, 4.1 If the username is dump or root, we just select one randomly. 4.2 Else, no servers are selected.
func UpdateStats ¶ added in v1.0.0
func UpdateStats(ctx context.Context, tbl *txnTable, s *plan2.StatsInfoMap) bool
calculate and update the stats for scan node.
func UpdateStatsForPartitionTable ¶ added in v1.0.0
func UpdateStatsForPartitionTable(ctx context.Context, baseTable *txnTable, partitionTables []any, s *plan2.StatsInfoMap) bool
calculate and update the stats for scan node.
Types ¶
type Engine ¶
func New ¶
func New( ctx context.Context, mp *mpool.MPool, fs fileservice.FileService, cli client.TxnClient, idGen IDGenerator, ) *Engine
func (*Engine) AllocateIDByKey ¶ added in v0.8.0
func (*Engine) GetNameById ¶ added in v0.7.0
func (*Engine) GetRelationById ¶ added in v0.7.0
func (*Engine) InitLogTailPushModel ¶ added in v0.8.0
func (*Engine) NewBlockReader ¶
func (*Engine) UpdateOfPull ¶ added in v0.8.0
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry represents a delete/insert
type IDGenerator ¶
type PartitionReader ¶
type PartitionReader struct {
// contains filtered or unexported fields
}
func (*PartitionReader) Close ¶
func (p *PartitionReader) Close() error
func (*PartitionReader) Count ¶ added in v1.0.0
func (p *PartitionReader) Count() *engine.ReaderCount
type Transaction ¶
Transaction represents a transaction
func (*Transaction) Adjust ¶ added in v1.0.0
func (txn *Transaction) Adjust() error
Adjust adjust writes order
func (*Transaction) Commit ¶ added in v0.8.0
func (txn *Transaction) Commit(ctx context.Context) ([]txn.TxnRequest, error)
func (*Transaction) EndStatement ¶ added in v1.0.0
func (txn *Transaction) EndStatement()
func (*Transaction) GetSQLCount ¶ added in v1.0.0
func (txn *Transaction) GetSQLCount() uint64
func (*Transaction) IncrSQLCount ¶ added in v1.0.0
func (txn *Transaction) IncrSQLCount()
func (*Transaction) IncrStatementID ¶ added in v0.8.0
func (txn *Transaction) IncrStatementID(ctx context.Context, commit bool) error
func (*Transaction) PutCnBlockDeletes ¶ added in v0.8.0
func (txn *Transaction) PutCnBlockDeletes(blockId *types.Blockid, offsets []int64)
func (*Transaction) ReadOnly ¶
func (txn *Transaction) ReadOnly() bool
detecting whether a transaction is a read-only transaction
func (*Transaction) Rollback ¶ added in v0.8.0
func (txn *Transaction) Rollback(ctx context.Context) error
func (*Transaction) RollbackLastStatement ¶ added in v0.8.0
func (txn *Transaction) RollbackLastStatement(ctx context.Context) error
func (*Transaction) StartStatement ¶ added in v1.0.0
func (txn *Transaction) StartStatement()
func (*Transaction) WriteBatch ¶
func (txn *Transaction) WriteBatch( typ int, databaseId uint64, tableId uint64, databaseName string, tableName string, bat *batch.Batch, tnStore DNStore, primaryIdx int, insertBatchHasRowId bool, truncate bool) error
WriteBatch used to write data to the transaction buffer insert/delete/update all use this api insertBatchHasRowId : it denotes the batch has Rowid when the typ is INSERT. if typ is not INSERT, it is always false. truncate : it denotes the batch with typ DELETE on mo_tables is generated when Truncating a table.
func (*Transaction) WriteFile ¶
func (txn *Transaction) WriteFile( typ int, databaseId, tableId uint64, databaseName, tableName string, fileName string, bat *batch.Batch, tnStore DNStore) error
WriteFile used to add a s3 file information to the transaction buffer insert/delete/update all use this api