Documentation
¶
Index ¶
- Constants
- Variables
- func AddChildTblIdToParentTable(ctx context.Context, fkRelation engine.Relation, tblId uint64) error
- func AddFkeyToRelation(ctx context.Context, fkRelation engine.Relation, fkey *plan.ForeignKeyDef) error
- func ApplyRuntimeFilters(ctx context.Context, proc *process.Process, tableDef *plan.TableDef, ...) (engine.RelData, error)
- func AttachInternalExecutorPrivilegeCheck(ctx context.Context) context.Context
- func AttachInternalExecutorSession(ctx context.Context, ses process.Session) context.Context
- func CDCParseGranularityTuple(ctx context.Context, level string, pattern string, dup map[string]struct{}) (pt *cdc.PatternTuple, err error)
- func CDCParsePitrGranularity(ctx context.Context, level string, tables string) (pts *cdc.PatternTuples, err error)
- func CDCParseTableInfo(ctx context.Context, input string, level string) (db string, table string, err error)
- func CDCStrToTime(tsStr string, tz *time.Location) (ts time.Time, err error)
- func CheckSysMoCatalogPitrResult(ctx context.Context, vecs []*vector.Vector, newLength uint64, newUnit string) (needInsert, needUpdate bool, err error)
- func CnServerMessageHandler(ctx context.Context, serverAddress string, message morpc.Message, ...) (err error)
- func ConvertOperatorToPhyOperator(op vm.Operator, rmp map[*process.WaitRegister]int) *models.PhyOperator
- func ConvertScopeToPhyScope(scope *Scope, receiverMap map[*process.WaitRegister]int) models.PhyScope
- func ConvertSourceToPhySource(source *Source) *models.PhySource
- func CreateAllIndexCdcTasks(c *Compile, indexes []*plan.IndexDef, dbname string, tablename string, ...) error
- func CreateAllIndexUpdateTasks(c *Compile, indexes []*plan.IndexDef, dbname string, tablename string, ...) (err error)
- func CreateCdcTask(c *Compile, spec *iscp.JobSpec, job *iscp.JobID, startFromNow bool) (bool, error)
- func CreateIndexCdcTask(c *Compile, dbname string, tablename string, tableid uint64, indexname string, ...) error
- func DebugShowScopes(ss []*Scope, level DebugLevel) string
- func DecodeMergeGroup(merge *group.MergeGroup, pipe *pipeline.Group)
- func DeleteCdcTask(c *Compile, job *iscp.JobID) (bool, error)
- func DropAllIndexCdcTasks(c *Compile, tabledef *plan.TableDef, dbname string, tablename string) error
- func DropAllIndexUpdateTasks(c *Compile, tabledef *plan.TableDef, dbname string, tablename string) (err error)
- func DropIndexCdcTask(c *Compile, tableDef *plan.TableDef, dbname string, tablename string, ...) error
- func EncodeMergeGroup(merge *group.MergeGroup, pipe *pipeline.Group)
- func ExecuteAndGetRowsAffected(ctx context.Context, tx taskservice.SqlExecutor, query string, ...) (int64, error)
- func GetConstraintDefFromTableDefs(defs []engine.TableDef) *engine.ConstraintDef
- func GetExternParallelSize(totalSize int64, cpuNum int) int
- func MakeNewCreateConstraint(oldCt *engine.ConstraintDef, c engine.Constraint) (*engine.ConstraintDef, error)
- func MarkQueryDone(c *Compile, txn txnClient.TxnOperator)
- func MarkQueryRunning(c *Compile, txn txnClient.TxnOperator)
- func NewSQLExecutor(addr string, eng engine.Engine, mp *mpool.MPool, txnClient client.TxnClient, ...) executor.SQLExecutor
- func RegisterJob(ctx context.Context, cnUUID string, txn client.TxnOperator, spec *iscp.JobSpec, ...) (bool, error)
- func ReleaseScopes(ss []*Scope)
- func ShowPipelineLink(node vm.Operator, mp map[*process.WaitRegister]int, buffer *bytes.Buffer)
- func ShowPipelineTree(node vm.Operator, prefix string, isRoot bool, isTail bool, ...)
- func StrictSqlMode(proc *process.Process) (error, bool)
- func UnregisterJob(ctx context.Context, cnUUID string, txn client.TxnOperator, job *iscp.JobID) (bool, error)
- func UpdatePreparePhyOperator(op vm.Operator, phyOp *models.PhyOperator) bool
- func UpdatePreparePhyScope(scope *Scope, phyScope models.PhyScope) bool
- func UpdateScopeTxnOffset(scope *Scope, txnOffset int)
- type AnalyzeModule
- func (anal *AnalyzeModule) AppendRemotePhyPlan(remotePhyPlan models.PhyPlan)
- func (anal *AnalyzeModule) GetExplainPhyBuffer() *bytes.Buffer
- func (anal *AnalyzeModule) GetPhyPlan() *models.PhyPlan
- func (anal *AnalyzeModule) Reset(isPrepare bool, isTpQuery bool)
- func (anal *AnalyzeModule) TypeName() string
- type CDCCreateTaskOptions
- func (opts *CDCCreateTaskOptions) BuildTaskDetails() (details *task.Details, err error)
- func (opts *CDCCreateTaskOptions) BuildTaskMetadata() task.TaskMetadata
- func (opts *CDCCreateTaskOptions) ToInsertTaskSQL(ctx context.Context, tx taskservice.SqlExecutor) (sql string, err error)
- func (opts *CDCCreateTaskOptions) ValidateAndFill(ctx context.Context, c *Compile, planCDC *plan.CreateCDC) (err error)
- type CDCUserInfo
- type Col
- type Compile
- func (c *Compile) AnalyzeExecPlan(runC *Compile, queryResult *util2.RunResult, stats *statistic.StatsInfo, ...)
- func (c *Compile) Compile(execTopContext context.Context, queryPlan *plan.Plan, ...) (err error)
- func (c *Compile) FreeOperator()
- func (c *Compile) GenPhyPlan(runC *Compile)
- func (c *Compile) GetAnalyzeModule() *AnalyzeModule
- func (c *Compile) GetMessageCenter() *message.MessageCenter
- func (c *Compile) GetPlan() *plan.Plan
- func (c *Compile) InitPipelineContextToExecuteQuery()
- func (c *Compile) InitPipelineContextToRetryQuery()
- func (c *Compile) IsSingleScope(ss []*Scope) bool
- func (c *Compile) IsTpQuery() bool
- func (c *Compile) Release()
- func (c *Compile) Reset(proc *process.Process, startAt time.Time, ...)
- func (c *Compile) Run(_ uint64) (queryResult *util2.RunResult, err error)
- func (c *Compile) SetBuildPlanFunc(buildPlanFunc func(ctx context.Context) (*plan2.Plan, error))
- func (c *Compile) SetIsPrepare(isPrepare bool)
- func (c *Compile) SetOriginSQL(sql string)
- func (c Compile) TypeName() string
- func (c *Compile) UpdatePreparePhyPlan(runC *Compile) bool
- type DebugLevel
- type ExplainOption
- type LockMeta
- type MultiTableIndex
- type ParallelScopeInfo
- type RemoteReceivRegInfo
- type RuntimeFilterEvaluator
- type RuntimeInFilter
- type RuntimeZonemapFilter
- type Scope
- func (s *Scope) AlterSequence(c *Compile) error
- func (s *Scope) AlterTable(c *Compile) (err error)
- func (s *Scope) AlterTableCopy(c *Compile) error
- func (s *Scope) AlterTableInplace(c *Compile) error
- func (s *Scope) AlterView(c *Compile) error
- func (s *Scope) CreateCDC(c *Compile) error
- func (s *Scope) CreateDatabase(c *Compile) error
- func (s *Scope) CreateIndex(c *Compile) error
- func (s *Scope) CreatePitr(c *Compile) error
- func (s *Scope) CreateSequence(c *Compile) error
- func (s *Scope) CreateTable(c *Compile) error
- func (s *Scope) CreateView(c *Compile) error
- func (s *Scope) DropCDC(c *Compile) error
- func (s *Scope) DropDatabase(c *Compile) error
- func (s *Scope) DropIndex(c *Compile) error
- func (s *Scope) DropPitr(c *Compile) error
- func (s *Scope) DropSequence(c *Compile) error
- func (s *Scope) DropTable(c *Compile) error
- func (s *Scope) FreeOperator(c *Compile)
- func (s *Scope) InitAllDataSource(c *Compile) error
- func (s *Scope) IsTableClone() bool
- func (s *Scope) MergeRun(c *Compile) error
- func (s *Scope) ParallelRun(c *Compile) (err error)
- func (s *Scope) RemoteRun(c *Compile) error
- func (s *Scope) RenameTable(c *Compile) (err error)
- func (s *Scope) Reset(c *Compile) error
- func (s *Scope) RestoreTable(c *Compile, clonePlan *plan.CloneTable) error
- func (s *Scope) Run(c *Compile) (err error)
- func (s *Scope) SetOperatorInfoRecursively(cb func() int32)
- func (s *Scope) TableClone(c *Compile) error
- func (s *Scope) TruncateTable(c *Compile) error
- func (s Scope) TypeName() string
- type ScopeAnalyzer
- type Source
- type TxnOperator
Constants ¶
const ( DistributedThreshold uint64 = 10 * mpool.MB SingleLineSizeEstimate uint64 = 300 * mpool.B NoAccountId = -1 )
Note: Now the cost going from stat is actually the number of rows, so we can only estimate a number for the size of each row. The current insertion of around 200,000 rows triggers cn to write s3 directly
const ( Merge magicType = iota Normal Remote CreateDatabase CreateTable CreatePitr CreateCDC CreateView CreateIndex DropDatabase DropTable DropPitr DropCDC DropIndex TruncateTable AlterView AlterTable RenameTable MergeInsert MergeDelete CreateSequence DropSequence AlterSequence Replace TableClone )
type of scope
const ( INDEX_TYPE_PRIMARY = "PRIMARY" INDEX_TYPE_UNIQUE = "UNIQUE" INDEX_TYPE_MULTIPLE = "MULTIPLE" INDEX_TYPE_FULLTEXT = "FULLTEXT" INDEX_TYPE_SPATIAL = "SPATIAL" )
const ( INDEX_VISIBLE_YES = 1 INDEX_VISIBLE_NO = 0 )
const ( INDEX_HIDDEN_YES = 1 INDEX_HIDDEN_NO = 0 )
const ( NULL_VALUE = "null" EMPTY_STRING = "" )
const (
ALLOCID_INDEX_KEY = "index_key"
)
const MaxRpcTime = time.Hour * 24
MaxRpcTime is a default timeout time to rpc context if user never set this deadline. this is just a number I casually wrote, the purpose of doing this is that any message sent through rpc need a clear deadline.
const StreamMaxInterval = 8192
Variables ¶
var ForeachQueriedRow = func( ctx context.Context, tx taskservice.SqlExecutor, query string, onEachRow func(context.Context, *sql.Rows) (bool, error), ) (cnt int64, err error) { var ( ok bool rows *sql.Rows ) if rows, err = tx.QueryContext(ctx, query); err != nil { return } if rows.Err() != nil { err = rows.Err() return } defer func() { _ = rows.Close() }() for rows.Next() { if ok, err = onEachRow(ctx, rows); err != nil { return } if ok { cnt++ } } return }
var GetConstraintDef = func(ctx context.Context, rel engine.Relation) (*engine.ConstraintDef, error) { defs, err := rel.TableDefs(ctx) if err != nil { return nil, err } return GetConstraintDefFromTableDefs(defs), nil }
Functions ¶
func AddChildTblIdToParentTable ¶ added in v1.1.2
func AddFkeyToRelation ¶ added in v1.1.2
func ApplyRuntimeFilters ¶ added in v1.0.0
func AttachInternalExecutorPrivilegeCheck ¶
AttachInternalExecutorPrivilegeCheck forces internal SQL to run through the normal privilege validation path instead of bypassing auth as trusted SQL.
func AttachInternalExecutorSession ¶
AttachInternalExecutorSession attaches the original frontend session to internal SQL so temp-table aliases and other session-scoped metadata resolve the same way they do for the user's statement.
func CDCParsePitrGranularity ¶
func CDCParseTableInfo ¶
func CheckSysMoCatalogPitrResult ¶
func CheckSysMoCatalogPitrResult(ctx context.Context, vecs []*vector.Vector, newLength uint64, newUnit string) (needInsert, needUpdate bool, err error)
CheckSysMoCatalogPitrResult parses the sys_mo_catalog_pitr query result and determines whether to insert or update. Arguments:
ctx: context for error reporting vecs: the vectors from the query result (should have at least 2 columns) newLength: the new PITR length to compare newUnit: the new PITR unit to compare
Returns:
needInsert: true if sys_mo_catalog_pitr does not exist needUpdate: true if it exists and needs update oldLength, oldUnit: the old values if exist (for debug) err: error if any
func CnServerMessageHandler ¶ added in v0.6.0
func CnServerMessageHandler( ctx context.Context, serverAddress string, message morpc.Message, cs morpc.ClientSession, storageEngine engine.Engine, fileService fileservice.FileService, lockService lockservice.LockService, queryClient qclient.QueryClient, HaKeeper logservice.CNHAKeeperClient, udfService udf.Service, txnClient client.TxnClient, autoIncreaseCM *defines.AutoIncrCacheManager, messageAcquirer func() morpc.Message) (err error)
CnServerMessageHandler receive and deal the message from cn-client.
The message should always *pipeline.Message here. there are 2 types of pipeline message now.
notify message : a message to tell the dispatch pipeline where its remote receiver are. and we use this connection's write-back method to send the data. or a message to stop the running pipeline.
scope message : a message contains the encoded pipeline. we decoded it and run it locally.
func ConvertOperatorToPhyOperator ¶
func ConvertOperatorToPhyOperator(op vm.Operator, rmp map[*process.WaitRegister]int) *models.PhyOperator
ConvertOperatorToPhyOperator converts an Operator tree to a PhyOperator tree. All PhyOperator nodes and child-pointer slices are allocated from a single arena to minimize heap allocations and reduce GC pressure.
func ConvertScopeToPhyScope ¶
func CreateAllIndexCdcTasks ¶
func CreateAllIndexCdcTasks(c *Compile, indexes []*plan.IndexDef, dbname string, tablename string, tableid uint64, startFromNow bool, tableDef *plan.TableDef) error
NOTE: CreateAllIndexCdcTasks will create CDC task according to existing tableDef
func CreateAllIndexUpdateTasks ¶
func CreateAllIndexUpdateTasks(c *Compile, indexes []*plan.IndexDef, dbname string, tablename string, tableid uint64) (err error)
idxcron function
func CreateCdcTask ¶
func CreateCdcTask(c *Compile, spec *iscp.JobSpec, job *iscp.JobID, startFromNow bool) (bool, error)
start here
func CreateIndexCdcTask ¶
func CreateIndexCdcTask(c *Compile, dbname string, tablename string, tableid uint64, indexname string, sinker_type int8, startFromNow bool, sql string, tableDef *plan.TableDef) error
NOTE: CreateIndexCdcTask will create CDC task without any checking. Original TableDef may be empty
func DebugShowScopes ¶ added in v0.6.0
func DebugShowScopes(ss []*Scope, level DebugLevel) string
DebugShowScopes generates and returns a string representation of debugging information for a set of scopes.
func DecodeMergeGroup ¶ added in v1.1.0
func DecodeMergeGroup(merge *group.MergeGroup, pipe *pipeline.Group)
func DropAllIndexCdcTasks ¶
func DropAllIndexCdcTasks(c *Compile, tabledef *plan.TableDef, dbname string, tablename string) error
drop all cdc tasks according to tableDef
func DropAllIndexUpdateTasks ¶
func DropAllIndexUpdateTasks(c *Compile, tabledef *plan.TableDef, dbname string, tablename string) (err error)
drop all cdc tasks according to tableDef
func DropIndexCdcTask ¶
func EncodeMergeGroup ¶ added in v1.1.0
func EncodeMergeGroup(merge *group.MergeGroup, pipe *pipeline.Group)
func ExecuteAndGetRowsAffected ¶
func ExecuteAndGetRowsAffected( ctx context.Context, tx taskservice.SqlExecutor, query string, args ...interface{}, ) (int64, error)
func GetConstraintDefFromTableDefs ¶ added in v1.1.2
func GetConstraintDefFromTableDefs(defs []engine.TableDef) *engine.ConstraintDef
func GetExternParallelSize ¶
func MakeNewCreateConstraint ¶ added in v1.1.2
func MakeNewCreateConstraint(oldCt *engine.ConstraintDef, c engine.Constraint) (*engine.ConstraintDef, error)
func MarkQueryDone ¶
func MarkQueryDone(c *Compile, txn txnClient.TxnOperator)
func MarkQueryRunning ¶
func MarkQueryRunning(c *Compile, txn txnClient.TxnOperator)
func NewSQLExecutor ¶ added in v0.8.0
func NewSQLExecutor( addr string, eng engine.Engine, mp *mpool.MPool, txnClient client.TxnClient, fs fileservice.FileService, qc qclient.QueryClient, hakeeper logservice.CNHAKeeperClient, us udf.Service, taskService taskservice.TaskService, ) executor.SQLExecutor
NewSQLExecutor returns a internal used sql service. It can execute sql in current CN.
func RegisterJob ¶
func RegisterJob(ctx context.Context, cnUUID string, txn client.TxnOperator, spec *iscp.JobSpec, job *iscp.JobID, startFromNow bool) (bool, error)
CDC APIs
func ReleaseScopes ¶ added in v1.1.0
func ReleaseScopes(ss []*Scope)
func ShowPipelineLink ¶
func ShowPipelineTree ¶
func UnregisterJob ¶
func UpdatePreparePhyOperator ¶
func UpdatePreparePhyOperator(op vm.Operator, phyOp *models.PhyOperator) bool
func UpdatePreparePhyScope ¶
func UpdateScopeTxnOffset ¶
Types ¶
type AnalyzeModule ¶
type AnalyzeModule struct {
// contains filtered or unexported fields
}
func (*AnalyzeModule) AppendRemotePhyPlan ¶
func (anal *AnalyzeModule) AppendRemotePhyPlan(remotePhyPlan models.PhyPlan)
func (*AnalyzeModule) GetExplainPhyBuffer ¶
func (anal *AnalyzeModule) GetExplainPhyBuffer() *bytes.Buffer
func (*AnalyzeModule) GetPhyPlan ¶
func (anal *AnalyzeModule) GetPhyPlan() *models.PhyPlan
func (*AnalyzeModule) Reset ¶
func (anal *AnalyzeModule) Reset(isPrepare bool, isTpQuery bool)
Reset When Compile reused, reset AnalyzeModule to prevent resource accumulation
func (*AnalyzeModule) TypeName ¶
func (anal *AnalyzeModule) TypeName() string
type CDCCreateTaskOptions ¶
type CDCCreateTaskOptions struct {
TaskName string
TaskId string
UserInfo *CDCUserInfo
Exclude string
StartTs string
EndTs string
MaxSqlLength int64
PitrTables string // json encoded pitr tables: cdc2.PatternTuples
SrcUri string // json encoded source uri: cdc2.UriInfo
SrcUriInfo cdc.UriInfo
SinkUri string // json encoded sink uri: cdc2.UriInfo
SinkUriInfo cdc.UriInfo
ExtraOpts string // json encoded extra opts: map[string]any
SinkType string
NoFull bool
ConfigFile string
// control options
UseConsole bool
}
func (*CDCCreateTaskOptions) BuildTaskDetails ¶
func (opts *CDCCreateTaskOptions) BuildTaskDetails() (details *task.Details, err error)
func (*CDCCreateTaskOptions) BuildTaskMetadata ¶
func (opts *CDCCreateTaskOptions) BuildTaskMetadata() task.TaskMetadata
func (*CDCCreateTaskOptions) ToInsertTaskSQL ¶
func (opts *CDCCreateTaskOptions) ToInsertTaskSQL( ctx context.Context, tx taskservice.SqlExecutor, ) (sql string, err error)
func (*CDCCreateTaskOptions) ValidateAndFill ¶
type CDCUserInfo ¶
type Compile ¶ added in v0.5.0
type Compile struct {
// TxnOffset read starting offset position within the transaction during the execute current statement
TxnOffset int
MessageBoard *message.MessageBoard
// contains filtered or unexported fields
}
Compile contains all the information needed for compilation.
func NewCompile ¶ added in v1.1.0
func NewCompile( addr, db, sql, tenant, uid string, e engine.Engine, proc *process.Process, stmt tree.Statement, isInternal bool, cnLabel map[string]string, startAt time.Time, ) *Compile
NewCompile is used to new an object of compile
func (*Compile) AnalyzeExecPlan ¶
func (*Compile) Compile ¶ added in v0.5.0
func (c *Compile) Compile( execTopContext context.Context, queryPlan *plan.Plan, resultWriteBack func(batch *batch.Batch, crs *perfcounter.CounterSet) error) (err error)
Compile generates the node level execution pipeline from the query plan, and the final pipeline will be stored in the attribute `scope` of a Compile object.
func (*Compile) FreeOperator ¶
func (c *Compile) FreeOperator()
func (*Compile) GenPhyPlan ¶
func (*Compile) GetAnalyzeModule ¶
func (c *Compile) GetAnalyzeModule() *AnalyzeModule
func (*Compile) GetMessageCenter ¶
func (c *Compile) GetMessageCenter() *message.MessageCenter
func (*Compile) GetPlan ¶
GetPlan returns the current plan of the Compile. This is useful for getting the latest plan after a retry.
func (*Compile) InitPipelineContextToExecuteQuery ¶
func (c *Compile) InitPipelineContextToExecuteQuery()
InitPipelineContextToExecuteQuery initializes the context for each pipeline tree.
the entire process must follow these rules: 1. the query context can control the context of all pipelines. 2. if there's a data transfer between two pipelines, the lifecycle of the sender's context ends with the receiver's termination.
func (*Compile) InitPipelineContextToRetryQuery ¶
func (c *Compile) InitPipelineContextToRetryQuery()
InitPipelineContextToRetryQuery initializes the context for each pipeline tree. the only place diff to InitPipelineContextToExecuteQuery is this function build query context from the last query.
func (*Compile) IsSingleScope ¶
func (*Compile) SetBuildPlanFunc ¶ added in v1.0.0
func (*Compile) SetIsPrepare ¶
func (*Compile) SetOriginSQL ¶ added in v1.2.0
func (*Compile) UpdatePreparePhyPlan ¶
true means update success, if return false, GenPhyPlan
type DebugLevel ¶
type DebugLevel int
const ( NormalLevel DebugLevel = iota VerboseLevel AnalyzeLevel OldLevel )
type ExplainOption ¶
type LockMeta ¶
type LockMeta struct {
// contains filtered or unexported fields
}
func NewLockMeta ¶
func NewLockMeta() *LockMeta
type MultiTableIndex ¶ added in v1.2.0
type ParallelScopeInfo ¶
type ParallelScopeInfo struct {
NodeIdxTimeConsumeMajor map[int]int64
NodeIdxTimeConsumeMinor map[int]int64
}
func NewParallelScopeInfo ¶
func NewParallelScopeInfo() *ParallelScopeInfo
type RemoteReceivRegInfo ¶ added in v0.7.0
type RuntimeFilterEvaluator ¶ added in v1.0.0
type RuntimeInFilter ¶ added in v1.0.0
type RuntimeZonemapFilter ¶ added in v1.0.0
type Scope ¶
type Scope struct {
// Magic specifies the type of Scope.
// 0 - execution unit for reading data.
// 1 - execution unit for processing intermediate results.
// 2 - execution unit that requires remote call.
Magic magicType
// IsEnd means the pipeline is end
IsEnd bool
// IsRemote means the pipeline is remote
IsRemote bool
// IsLoad means the pipeline is load
IsLoad bool
// IsTbFunc means the leaf op of pipeline is tablefunction, tablefunction is src op
IsTbFunc bool
HasPartialResults bool
// StarCountOnly: when true, aggOptimize took the single-starcount fast path.
// buildReaders should return EmptyReaders and no data should flow.
StarCountOnly bool
// StarCountMergeGroup: set when StarCountOnly is true; resetForReuse clears its PartialResults.
StarCountMergeGroup *group.MergeGroup
Plan *plan.Plan
// DataSource stores information about data source.
DataSource *Source
// PreScopes contains children of this scope will inherit and execute.
PreScopes []*Scope
// NodeInfo contains the information about the remote node.
NodeInfo engine.Node
// TxnOffset represents the transaction's write offset, specifying the starting position for reading data.
TxnOffset int
// Instructions contains command list of this scope.
// Instructions vm.Instructions
RootOp vm.Operator
// Proc contains the execution context.
Proc *process.Process
ScopeAnalyzer *ScopeAnalyzer
RemoteReceivRegInfos []RemoteReceivRegInfo
}
Scope is the output of the compile process. Each sql will be compiled to one or more execution unit scopes.
func (*Scope) AlterSequence ¶ added in v1.0.0
func (*Scope) AlterTable ¶ added in v0.8.0
func (*Scope) AlterTableCopy ¶ added in v1.0.0
func (*Scope) AlterTableInplace ¶ added in v1.0.0
func (*Scope) CreateDatabase ¶
func (*Scope) CreateIndex ¶
func (*Scope) CreatePitr ¶
func (*Scope) CreateSequence ¶ added in v0.8.0
func (*Scope) CreateTable ¶
func (*Scope) CreateView ¶ added in v1.2.1
func (*Scope) DropDatabase ¶
func (*Scope) DropSequence ¶ added in v0.8.0
func (*Scope) FreeOperator ¶
func (*Scope) InitAllDataSource ¶ added in v1.2.0
func (*Scope) IsTableClone ¶
IsTableClone reports whether this scope executes a `create table … clone` — the statement snapshot/restore replays to rebuild a table. Restore-aware behavior in the compile/plugin layer keys off this: the experimental-flag gate below, and pluginCompileCtx.IsTableClone exposed to index plugins.
func (*Scope) MergeRun ¶
MergeRun case 1 :
specific run for Tp query without merge operator.
case 2 :
normal merge run. 1. start n goroutines from pool to run the pre-scope. 2. send notify message to remote node for its data producer. 3. run itself. 4. listen to all running pipelines, once any error occurs, stop the NormalMergeRun asap.
func (*Scope) ParallelRun ¶
ParallelRun run a pipeline in parallel.
func (*Scope) RenameTable ¶
func (*Scope) RestoreTable ¶
func (s *Scope) RestoreTable(c *Compile, clonePlan *plan.CloneTable) error
RestoreTable is the clone/restore-path twin of cloneUnaffectedIndexes (pkg/sql/compile/alter.go). CreateTable (already run by TableClone) seeds the index hidden tables and registers their CDC; the block-level clone in table_clone APPENDS onto those tables. So, in place of a bare s.Run(c):
- drop the index CDC tasks before cloning data;
- for each hidden table the plugin lists in DeleteBeforeClone (IVF-FLAT's metadata/centroids/entries — seeded non-empty by CreateTable), empty the seed with `DELETE … WHERE TRUE` (a content delete that keeps the table and its id — NOT truncate, which re-creates the table);
- s.Run(c): clone the main table + index hidden tables (append onto empty);
- re-register each index's CDC startFromNow=true with a PLUGIN-PROVIDED InitSQL. For a vector index that InitSQL is `ALTER … REINDEX … FORCE_SYNC`, so the CDC's first iteration runs the reindex in its own post-commit txn — rebuilding the model from the committed cloned rows and re-arming the CDC at the post-clone watermark. Running it as InitSQL (not inline in this clone txn) is what avoids the SnapshotTS replay that double-counts the cloned rows.
func (*Scope) Run ¶
Run read data from storage engine and run the instructions of scope. Note: The prepare time for executing the `scope`.`Run()` method is very short, and no statistics are done
func (*Scope) SetOperatorInfoRecursively ¶ added in v1.2.0
func (*Scope) TableClone ¶
func (*Scope) TruncateTable ¶ added in v0.6.0
type ScopeAnalyzer ¶
type ScopeAnalyzer struct {
TimeConsumed int64 // Stores the total time consumed between Start and Stop in nanoseconds
// contains filtered or unexported fields
}
func NewScopeAnalyzer ¶
func NewScopeAnalyzer() *ScopeAnalyzer
func (*ScopeAnalyzer) Reset ¶
func (sa *ScopeAnalyzer) Reset()
Reset clears the analyzer's state, allowing it to start again. Both isStarted and isStoped flags are reset.
func (*ScopeAnalyzer) Start ¶
func (sa *ScopeAnalyzer) Start()
Start begins the time tracking. It will not start if it has already started or if it has been stopped.
func (*ScopeAnalyzer) Stop ¶
func (sa *ScopeAnalyzer) Stop()
Stop halts the time tracking and calculates the duration. It won't perform any actions if it has not started or if it has already been stopped.
type Source ¶
type Source struct {
PushdownId uint64
PushdownAddr string
SchemaName string
RelationName string
Attributes []string
R engine.Reader
Rel engine.Relation
FilterExpr *plan.Expr // todo: change this to []*plan.Expr, is FilterList + RuntimeFilter
FilterList []*plan.Expr //from node.FilterList, use for reader
BlockFilterList []*plan.Expr //from node.BlockFilterList, use for range
TableDef *plan.TableDef
Timestamp timestamp.Timestamp
AccountId *plan.PubInfo
RuntimeFilterSpecs []*plan.RuntimeFilterSpec
OrderBy []*plan.OrderBySpec // for ordered scan
IndexReaderParam *plan.IndexReaderParam
RecvMsgList []plan.MsgHeader
MembershipFilterBytes []byte
// contains filtered or unexported fields
}
Source contains information of a relation which will be used in execution.
type TxnOperator ¶ added in v0.6.0
type TxnOperator = client.TxnOperator
Source Files
¶
- alter.go
- analyze_module.go
- compile.go
- compile2.go
- compileService.go
- ddl.go
- ddl_index_algo.go
- debugTools.go
- fuzzyCheck.go
- internal_executor_session.go
- iscp_util.go
- lock_meta.go
- log.go
- operator.go
- plugin_context.go
- pub_sub.go
- remote_expr.go
- remoterun.go
- remoterunClient.go
- remoterunServer.go
- reuse.go
- runtime_filter.go
- scope.go
- sql_executor.go
- sql_executor_context.go
- types.go
- util.go