executorcontext

package
v0.0.0-...-3831271 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBufferingRetries = 3

MaxBufferingRetries is to represent max retries on buffering.

View Source
const TxRollback = "Rollback Transaction"

Variables

View Source
var ErrNoKeyspace = vterrors.VT09005()

Functions

func ParseDestinationTarget

func ParseDestinationTarget(targetString string, tablet topodatapb.TabletType, vschema *vindexes.VSchema) (string, topodatapb.TabletType, key.ShardDestination, error)

ParseDestinationTarget parses destination target string and provides a keyspace if possible.

Types

type ExecuteLogger

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

func (*ExecuteLogger) GetLogs

func (l *ExecuteLogger) GetLogs() []engine.ExecuteEntry

func (*ExecuteLogger) Log

func (l *ExecuteLogger) Log(primitive engine.Primitive, target *querypb.Target, gateway srvtopo.Gateway, query string, begin bool, bv map[string]*querypb.BindVariable)

type FakeTopoServer

type FakeTopoServer struct{}

func (*FakeTopoServer) GetSrvKeyspace

func (f *FakeTopoServer) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error)

GetSrvKeyspace returns the SrvKeyspace for a cell/keyspace.

func (*FakeTopoServer) GetSrvKeyspaceNames

func (f *FakeTopoServer) GetSrvKeyspaceNames(ctx context.Context, cell string, staleOK bool) ([]string, error)

GetSrvKeyspaceNames returns the list of keyspaces served in the provided cell.

func (*FakeTopoServer) GetTopoServer

func (f *FakeTopoServer) GetTopoServer() (*topo.Server, error)

GetTopoServer returns the full topo.Server instance.

func (*FakeTopoServer) WatchSrvKeyspace

func (f *FakeTopoServer) WatchSrvKeyspace(ctx context.Context, cell, keyspace string, callback func(*topodatapb.SrvKeyspace, error) bool)

func (*FakeTopoServer) WatchSrvVSchema

func (f *FakeTopoServer) WatchSrvVSchema(ctx context.Context, cell string, callback func(*vschemapb.SrvVSchema, error) bool)

WatchSrvVSchema starts watching the SrvVSchema object for the provided cell. It will call the callback when a new value or an error occurs.

type Metrics

type Metrics interface {
	GetExecutionMetrics() *engine.Metrics
}

type Resolver

type Resolver interface {
	GetGateway() srvtopo.Gateway
	ResolveDestinations(
		ctx context.Context,
		keyspace string,
		tabletType topodatapb.TabletType,
		ids []*querypb.Value,
		destinations []key.ShardDestination,
	) ([]*srvtopo.ResolvedShard, [][]*querypb.Value, error)
	ResolveDestinationsMultiCol(
		ctx context.Context,
		keyspace string,
		tabletType topodatapb.TabletType,
		ids [][]sqltypes.Value,
		destinations []key.ShardDestination,
	) ([]*srvtopo.ResolvedShard, [][][]sqltypes.Value, error)
}

type ResultsObserver

type ResultsObserver interface {
	Observe(*sqltypes.Result)
}

type SafeSession

type SafeSession struct {
	*vtgatepb.Session
	// contains filtered or unexported fields
}

SafeSession is a mutex-protected version of the Session. It is thread-safe if each thread only accesses one shard. (the use pattern is 'Find', if not found, then 'AppendOrUpdate', for a single shard)

func NewAutocommitSession

func NewAutocommitSession(sessn *vtgatepb.Session) *SafeSession

NewAutocommitSession returns a SafeSession based on the original session, but with autocommit enabled.

func NewSafeSession

func NewSafeSession(sessn *vtgatepb.Session) *SafeSession

NewSafeSession returns a new SafeSession based on the Session

func (*SafeSession) AddAdvisoryLock

func (session *SafeSession) AddAdvisoryLock(name string)

AddAdvisoryLock adds the advisory lock to the list.

func (*SafeSession) AppendOrUpdate

func (session *SafeSession) AppendOrUpdate(target *querypb.Target, info ShardActionInfo, existingSession *vtgatepb.Session_ShardSession, txMode vtgatepb.TransactionMode) error

AppendOrUpdate adds a new ShardSession, or updates an existing one if one already exists for the given shard session

func (*SafeSession) AutocommitApproval

func (session *SafeSession) AutocommitApproval() bool

AutocommitApproval returns true if we can perform a single round-trip autocommit. If so, the caller is responsible for committing their transaction.

func (*SafeSession) CachePlan

func (session *SafeSession) CachePlan() bool

func (*SafeSession) CanAddSavepoint

func (session *SafeSession) CanAddSavepoint() bool

CanAddSavepoint returns true if we should insert savepoint and there is no existing savepoint.

func (*SafeSession) ClearAdvisoryLock

func (session *SafeSession) ClearAdvisoryLock()

ClearAdvisoryLock clears the advisory lock list.

func (*SafeSession) ClearWarnings

func (session *SafeSession) ClearWarnings()

ClearWarnings removes all the warnings from the session

func (*SafeSession) EnableLogging

func (session *SafeSession) EnableLogging(parser *sqlparser.Parser)

func (*SafeSession) FindAndChangeSessionIfInSingleTxMode

func (session *SafeSession) FindAndChangeSessionIfInSingleTxMode(keyspace, shard string, tabletType topodatapb.TabletType, txMode vtgatepb.TransactionMode) (*vtgatepb.Session_ShardSession, error)

FindAndChangeSessionIfInSingleTxMode retrieves the ShardSession matching the given keyspace, shard, and tablet type. It performs additional checks and may modify the ShardSession in specific cases for single-mode transactions.

Key behavior: 1. Retrieves the appropriate list of sessions (PreSessions, PostSessions, or default ShardSessions) based on the commit order. 2. Identifies a matching session by keyspace, shard, and tablet type. 3. If the session meets specific conditions (e.g., non-vindex-only, single transaction mode), it updates the session state:

  • Converts a vindex-only session to a standard session if required by the transaction type.
  • If a multi-shard transaction is detected in Single mode, marks the session for rollback and returns an error.

Parameters: - keyspace: The keyspace of the target shard. - shard: The shard name of the target. - tabletType: The type of the tablet for the shard session. - txMode: The transaction mode (e.g., Single, Multi).

Returns: - The matching ShardSession, if found and valid for the operation. - An error if a Single-mode transaction attempts to span multiple shards.

func (*SafeSession) ForeignKeyChecks

func (session *SafeSession) ForeignKeyChecks() *bool

ForeignKeyChecks returns the foreign_key_checks stored in system_variables map in the session.

func (*SafeSession) GetCommitOrder

func (session *SafeSession) GetCommitOrder() vtgatepb.CommitOrder

GetCommitOrder returns the commit order.

func (*SafeSession) GetDDLStrategy

func (session *SafeSession) GetDDLStrategy() string

GetDDLStrategy returns the DDLStrategy value.

func (*SafeSession) GetLockHeartbeat

func (session *SafeSession) GetLockHeartbeat() int64

GetLockHeartbeat returns last time the lock heartbeat was sent.

func (*SafeSession) GetLogger

func (session *SafeSession) GetLogger() *ExecuteLogger

GetLogger returns executor logger.

func (*SafeSession) GetLogs

func (session *SafeSession) GetLogs() []engine.ExecuteEntry

func (*SafeSession) GetMigrationContext

func (session *SafeSession) GetMigrationContext() string

GetMigrationContext returns the migration_context value.

func (*SafeSession) GetOrCreateOptions

func (session *SafeSession) GetOrCreateOptions() *querypb.ExecuteOptions

GetOrCreateOptions will return the current options struct, or create one and return it if no-one exists

func (*SafeSession) GetPrepareData

func (session *SafeSession) GetPrepareData(name string) *vtgatepb.PrepareData

GetPrepareData returns the prepared data information for the given key.

func (*SafeSession) GetQueryFromVindex

func (session *SafeSession) GetQueryFromVindex() bool

GetQueryFromVindex returns the queryFromVindex value.

func (*SafeSession) GetQueryTimeout

func (session *SafeSession) GetQueryTimeout() int64

GetQueryTimeout gets the query timeout

func (*SafeSession) GetRollbackOnPartialExec

func (session *SafeSession) GetRollbackOnPartialExec() string

GetRollbackOnPartialExec returns the rollbackOnPartialExec value.

func (*SafeSession) GetSelectLimit

func (session *SafeSession) GetSelectLimit() int

func (*SafeSession) GetSessionEnableSystemSettings

func (session *SafeSession) GetSessionEnableSystemSettings() bool

GetSessionEnableSystemSettings returns the SessionEnableSystemSettings value.

func (*SafeSession) GetSessionUUID

func (session *SafeSession) GetSessionUUID() string

GetSessionUUID returns the SessionUUID value.

func (*SafeSession) GetSessions

func (session *SafeSession) GetSessions() []*vtgatepb.Session_ShardSession

GetSessions returns the shard session for the current commit order.

func (*SafeSession) GetSystemVariables

func (session *SafeSession) GetSystemVariables(f func(k string, v string))

GetSystemVariables takes a visitor function that will receive each MySQL system variable in the session. This function will only yield system variables which apply to MySQL itself; Vitess-aware system variables will be skipped.

func (*SafeSession) GetUDV

func (session *SafeSession) GetUDV(name string) *querypb.BindVariable

GetUDV returns the bind variable value for the user defined variable.

func (*SafeSession) HasAdvisoryLock

func (session *SafeSession) HasAdvisoryLock() bool

HasAdvisoryLock returns if any advisory lock is taken

func (*SafeSession) HasSystemVariables

func (session *SafeSession) HasSystemVariables() (found bool)

HasSystemVariables returns whether the session has system variables that would apply to MySQL

func (*SafeSession) InLockSession

func (session *SafeSession) InLockSession() bool

InLockSession returns whether locking is used on this session.

func (*SafeSession) InReservedConn

func (session *SafeSession) InReservedConn() bool

InReservedConn returns true if the session needs to execute on a dedicated connection

func (*SafeSession) InTransaction

func (session *SafeSession) InTransaction() bool

InTransaction returns true if we are in a transaction

func (*SafeSession) IsErrorUntilRollback

func (session *SafeSession) IsErrorUntilRollback() bool

func (*SafeSession) IsFoundRowsHandled

func (session *SafeSession) IsFoundRowsHandled() bool

IsFoundRowsHandled returns the foundRowsHandled.

func (*SafeSession) IsRollbackSet

func (session *SafeSession) IsRollbackSet() bool

IsRollbackSet returns true if rollback to savepoint can be done.

func (*SafeSession) IsTxOpen

func (session *SafeSession) IsTxOpen() bool

IsTxOpen returns true if there is open connection to any of the shard.

func (*SafeSession) Log

func (session *SafeSession) Log(primitive engine.Primitive, target *querypb.Target, gateway srvtopo.Gateway, query string, begin bool, bv map[string]*querypb.BindVariable)

func (*SafeSession) MustRollback

func (session *SafeSession) MustRollback() bool

MustRollback returns true if the transaction must be rolled back.

func (*SafeSession) NewAutocommitSession

func (session *SafeSession) NewAutocommitSession() *SafeSession

NewAutocommitSession returns a SafeSession based on the original session, but with autocommit enabled.

func (*SafeSession) RecordWarning

func (session *SafeSession) RecordWarning(warning *querypb.QueryWarning)

RecordWarning stores the given warning in the session

func (*SafeSession) RemoveAdvisoryLock

func (session *SafeSession) RemoveAdvisoryLock(name string)

RemoveAdvisoryLock removes the advisory lock from the list.

func (*SafeSession) RemoveInternalSavepoint

func (session *SafeSession) RemoveInternalSavepoint()

func (*SafeSession) Reset

func (session *SafeSession) Reset()

Reset clears the session

func (*SafeSession) ResetAll

func (session *SafeSession) ResetAll()

ResetAll resets the shard sessions and lock session.

func (*SafeSession) ResetLock

func (session *SafeSession) ResetLock()

ResetLock resets the lock session

func (*SafeSession) ResetShard

func (session *SafeSession) ResetShard(tabletAlias *topodatapb.TabletAlias) error

ResetShard reset the shard session for the provided tablet alias.

func (*SafeSession) ResetTx

func (session *SafeSession) ResetTx()

ResetTx clears the session

func (*SafeSession) SavePoints

func (session *SafeSession) SavePoints() []string

SavePoints returns the save points of the session. It's safe to use concurrently

func (*SafeSession) SavepointRollback

func (session *SafeSession) SavepointRollback()

SavepointRollback updates the state that transaction was rolledback to the savepoint stored in the session.

func (*SafeSession) SetAutocommittable

func (session *SafeSession) SetAutocommittable(flag bool)

SetAutocommittable sets the state to autocommitable if true. Otherwise, it's notAutocommitable.

func (*SafeSession) SetCommitOrder

func (session *SafeSession) SetCommitOrder(co vtgatepb.CommitOrder)

SetCommitOrder sets the commit order.

func (*SafeSession) SetDDLStrategy

func (session *SafeSession) SetDDLStrategy(strategy string)

SetDDLStrategy set the DDLStrategy setting.

func (*SafeSession) SetErrorUntilRollback

func (session *SafeSession) SetErrorUntilRollback(enable bool)

func (*SafeSession) SetFoundRows

func (session *SafeSession) SetFoundRows(value uint64)

SetFoundRows set the found rows value.

func (*SafeSession) SetInDMLExecution

func (session *SafeSession) SetInDMLExecution(inDMLExec bool)

SetInDMLExecution set the `inDMLExecution` value.

func (*SafeSession) SetLockSession

func (session *SafeSession) SetLockSession(lockSession *vtgatepb.Session_ShardSession)

SetLockSession sets the lock session.

func (*SafeSession) SetMigrationContext

func (session *SafeSession) SetMigrationContext(migrationContext string)

SetMigrationContext set the migration_context setting.

func (*SafeSession) SetOptions

func (session *SafeSession) SetOptions(options *querypb.ExecuteOptions)

SetOptions sets the options

func (*SafeSession) SetPreQueries

func (session *SafeSession) SetPreQueries() []string

SetPreQueries returns the prequeries that need to be run when reserving a connection

func (*SafeSession) SetQueryFromVindex

func (session *SafeSession) SetQueryFromVindex(value bool)

SetQueryFromVindex set the queryFromVindex value.

func (*SafeSession) SetQueryTimeout

func (session *SafeSession) SetQueryTimeout(queryTimeout int64)

SetQueryTimeout sets the query timeout

func (*SafeSession) SetReadAfterWriteGTID

func (session *SafeSession) SetReadAfterWriteGTID(vtgtid string)

SetReadAfterWriteGTID set the ReadAfterWriteGtid setting.

func (*SafeSession) SetReadAfterWriteTimeout

func (session *SafeSession) SetReadAfterWriteTimeout(timeout float64)

SetReadAfterWriteTimeout set the ReadAfterWriteTimeout setting.

func (*SafeSession) SetReservedConn

func (session *SafeSession) SetReservedConn(reservedConn bool)

SetReservedConn set the InReservedConn setting.

func (*SafeSession) SetRollback

func (session *SafeSession) SetRollback()

SetRollback sets the flag indicating that the transaction must be rolled back. The call is a no-op if the session is not in a transaction.

func (*SafeSession) SetRollbackCommand

func (session *SafeSession) SetRollbackCommand()

SetRollbackCommand stores the rollback command to session and executed if required.

func (*SafeSession) SetSavepoint

func (session *SafeSession) SetSavepoint(name string)

SetSavepoint stores the savepoint name to session.

func (*SafeSession) SetSavepointState

func (session *SafeSession) SetSavepointState(spNeed bool)

SetSavepointState sets the state only once for the complete query execution life. Calling the function multiple times will have no effect, only the first call would be used. Default state is savepointStateNotSet, if savepoint needed (spNeed true) then it will be set to savepointNeeded otherwise savepointNotNeeded.

func (*SafeSession) SetSessionEnableSystemSettings

func (session *SafeSession) SetSessionEnableSystemSettings(allow bool)

SetSessionEnableSystemSettings set the SessionEnableSystemSettings setting.

func (*SafeSession) SetSessionTrackGtids

func (session *SafeSession) SetSessionTrackGtids(enable bool)

SetSessionTrackGtids set the SessionTrackGtids setting.

func (*SafeSession) SetSystemVariable

func (session *SafeSession) SetSystemVariable(name string, expr string)

SetSystemVariable sets the system variable in the session.

func (*SafeSession) SetTargetString

func (session *SafeSession) SetTargetString(target string)

SetTargetString sets the target string in the session.

func (*SafeSession) SetUserDefinedVariable

func (session *SafeSession) SetUserDefinedVariable(key string, value *querypb.BindVariable)

SetUserDefinedVariable sets the user defined variable in the session.

func (*SafeSession) StorePrepareData

func (session *SafeSession) StorePrepareData(key string, value *vtgatepb.PrepareData)

StorePrepareData stores the prepared data information for the given key.

func (*SafeSession) StoreSavepoint

func (session *SafeSession) StoreSavepoint(sql string)

StoreSavepoint stores the savepoint and release savepoint queries in the session

func (*SafeSession) TimeZone

func (session *SafeSession) TimeZone() *time.Location

func (*SafeSession) UpdateLockHeartbeat

func (session *SafeSession) UpdateLockHeartbeat()

UpdateLockHeartbeat updates the LastLockHeartbeat time

type ShardActionInfo

type ShardActionInfo interface {
	TransactionID() int64
	ReservedID() int64
	RowsAffected() bool
	Alias() *topodatapb.TabletAlias
}

type VCursorConfig

type VCursorConfig struct {
	Collation collations.ID

	MaxMemoryRows      int
	EnableShardRouting bool
	DefaultTabletType  topodatapb.TabletType
	QueryTimeout       int
	DBDDLPlugin        string
	ForeignKeyMode     vschemapb.Keyspace_ForeignKeyMode
	SetVarEnabled      bool
	EnableViews        bool
	WarnShardedOnly    bool
	PlannerVersion     plancontext.PlannerVersion

	WarmingReadsPercent int
	WarmingReadsTimeout time.Duration
	WarmingReadsChannel chan bool
}

type VCursorImpl

type VCursorImpl struct {
	SafeSession *SafeSession
	// contains filtered or unexported fields
}

VCursorImpl implements the VCursor functionality used by dependent packages to call back into VTGate.

func NewVCursorImpl

func NewVCursorImpl(
	safeSession *SafeSession,
	marginComments sqlparser.MarginComments,
	executor iExecute,
	logStats *logstats.LogStats,
	vm VSchemaOperator,
	vschema *vindexes.VSchema,
	resolver Resolver,
	serv srvtopo.Server,
	observer ResultsObserver,
	cfg VCursorConfig,
	metrics Metrics,
) (*VCursorImpl, error)

NewVCursorImpl creates a VCursorImpl. Before creating this object, you have to separate out any marginComments that came with the query and supply it here. Trailing comments are typically sent by the application for various reasons, including as identifying markers. So, they have to be added back to all queries that are executed on behalf of the original query.

func (*VCursorImpl) AddAdvisoryLock

func (vc *VCursorImpl) AddAdvisoryLock(name string)

AddAdvisoryLock implements the SessionActions interface

func (*VCursorImpl) AllKeyspace

func (vc *VCursorImpl) AllKeyspace() ([]*vindexes.Keyspace, error)

AllKeyspace implements the ContextVSchema interface

func (*VCursorImpl) AnyAdvisoryLockTaken

func (vc *VCursorImpl) AnyAdvisoryLockTaken() bool

AnyAdvisoryLockTaken implements the SessionActions interface

func (*VCursorImpl) AnyKeyspace

func (vc *VCursorImpl) AnyKeyspace() (*vindexes.Keyspace, error)

func (*VCursorImpl) AutocommitApproval

func (vc *VCursorImpl) AutocommitApproval() bool

AutocommitApproval is part of the engine.VCursor interface.

func (*VCursorImpl) CachePlan

func (vc *VCursorImpl) CachePlan() bool

func (*VCursorImpl) CanUseSetVar

func (vc *VCursorImpl) CanUseSetVar() bool

func (*VCursorImpl) CheckForReservedConnection

func (vc *VCursorImpl) CheckForReservedConnection(setVarComment string, stmt sqlparser.Statement)

func (*VCursorImpl) ClearPrepareData

func (vc *VCursorImpl) ClearPrepareData(name string)

func (*VCursorImpl) CloneForMirroring

func (vc *VCursorImpl) CloneForMirroring(ctx context.Context) engine.VCursor

func (*VCursorImpl) CloneForReplicaWarming

func (vc *VCursorImpl) CloneForReplicaWarming(ctx context.Context) engine.VCursor

func (*VCursorImpl) Commit

func (vc *VCursorImpl) Commit(ctx context.Context) error

func (*VCursorImpl) ConnCollation

func (vc *VCursorImpl) ConnCollation() collations.ID

ConnCollation returns the collation of this session

func (*VCursorImpl) Environment

func (vc *VCursorImpl) Environment() *vtenv.Environment

Environment returns the vtenv associated with this session

func (*VCursorImpl) ErrorIfShardedF

func (vc *VCursorImpl) ErrorIfShardedF(ks *vindexes.Keyspace, warn, errFormat string, params ...any) error

ErrorIfShardedF implements the VCursor interface

func (*VCursorImpl) ExceedsMaxMemoryRows

func (vc *VCursorImpl) ExceedsMaxMemoryRows(numRows int) bool

ExceedsMaxMemoryRows returns a boolean indicating whether the maxMemoryRows value has been exceeded. Returns false if the max memory rows override directive is set to true.

func (*VCursorImpl) Execute

func (vc *VCursorImpl) Execute(ctx context.Context, method string, query string, bindVars map[string]*querypb.BindVariable, rollbackOnError bool, co vtgatepb.CommitOrder) (*sqltypes.Result, error)

Execute is part of the engine.VCursor interface.

func (*VCursorImpl) ExecuteKeyspaceID

func (vc *VCursorImpl) ExecuteKeyspaceID(ctx context.Context, keyspace string, ksid []byte, query string, bindVars map[string]*querypb.BindVariable, rollbackOnError, autocommit bool) (*sqltypes.Result, error)

ExecuteKeyspaceID is part of the engine.VCursor interface.

func (*VCursorImpl) ExecuteLock

func (vc *VCursorImpl) ExecuteLock(ctx context.Context, rs *srvtopo.ResolvedShard, query *querypb.BoundQuery, lockFuncType sqlparser.LockingFuncType) (*sqltypes.Result, error)

ExecuteLock is for executing advisory lock statements.

func (*VCursorImpl) ExecuteMultiShard

func (vc *VCursorImpl) ExecuteMultiShard(ctx context.Context, primitive engine.Primitive, rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, rollbackOnError, canAutocommit, fetchLastInsertID bool) (*sqltypes.Result, []error)

ExecuteMultiShard is part of the engine.VCursor interface.

func (*VCursorImpl) ExecutePrimitive

func (vc *VCursorImpl) ExecutePrimitive(ctx context.Context, primitive engine.Primitive, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

func (*VCursorImpl) ExecutePrimitiveStandalone

func (vc *VCursorImpl) ExecutePrimitiveStandalone(ctx context.Context, primitive engine.Primitive, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

func (*VCursorImpl) ExecuteStandalone

func (vc *VCursorImpl) ExecuteStandalone(ctx context.Context, primitive engine.Primitive, query string, bindVars map[string]*querypb.BindVariable, rs *srvtopo.ResolvedShard, fetchLastInsertID bool) (*sqltypes.Result, error)

ExecuteStandalone is part of the engine.VCursor interface.

func (*VCursorImpl) ExecuteVSchema

func (vc *VCursorImpl) ExecuteVSchema(ctx context.Context, keyspace string, vschemaDDL *sqlparser.AlterVschema) error

func (*VCursorImpl) FindKeyspace

func (vc *VCursorImpl) FindKeyspace(keyspace string) (*vindexes.Keyspace, error)

FindKeyspace implements the VSchema interface

func (*VCursorImpl) FindMirrorRule

func (vc *VCursorImpl) FindMirrorRule(name sqlparser.TableName) (*vindexes.MirrorRule, error)

FindMirrorRule finds the mirror rule for the requested table name and VSchema tablet type.

func (*VCursorImpl) FindRoutedShard

func (vc *VCursorImpl) FindRoutedShard(keyspace, shard string) (keyspaceName string, err error)

func (*VCursorImpl) FindRoutedTable

func (vc *VCursorImpl) FindRoutedTable(name sqlparser.TableName) (*vindexes.BaseTable, error)

func (*VCursorImpl) FindTable

FindTable finds the specified table. If the keyspace what specified in the input, it gets used as qualifier. Otherwise, the keyspace from the request is used, if one was provided.

func (*VCursorImpl) FindTableOrVindex

FindTableOrVindex finds the specified table or vindex.

func (*VCursorImpl) FindView

func (*VCursorImpl) FindViewTarget

func (vc *VCursorImpl) FindViewTarget(name sqlparser.TableName) (*vindexes.Keyspace, error)

FindViewTarget finds the specified view's target keyspace.

func (*VCursorImpl) FirstSortedKeyspace

func (vc *VCursorImpl) FirstSortedKeyspace() (*vindexes.Keyspace, error)

func (*VCursorImpl) ForeignKeyMode

func (vc *VCursorImpl) ForeignKeyMode(keyspace string) (vschemapb.Keyspace_ForeignKeyMode, error)

ForeignKeyMode implements the VCursor interface

func (*VCursorImpl) GetAggregateUDFs

func (vc *VCursorImpl) GetAggregateUDFs() []string

func (*VCursorImpl) GetAndEmptyWarnings

func (vc *VCursorImpl) GetAndEmptyWarnings() []*querypb.QueryWarning

func (*VCursorImpl) GetBindVars

func (vc *VCursorImpl) GetBindVars() map[string]*querypb.BindVariable

GetBindVars implements the VSchema interface

func (*VCursorImpl) GetContextWithTimeOut

func (vc *VCursorImpl) GetContextWithTimeOut(ctx context.Context) (context.Context, context.CancelFunc)

func (*VCursorImpl) GetDBDDLPluginName

func (vc *VCursorImpl) GetDBDDLPluginName() string

GetDBDDLPluginName implements the VCursor interface

func (*VCursorImpl) GetDDLStrategy

func (vc *VCursorImpl) GetDDLStrategy() string

GetDDLStrategy implements the SessionActions interface

func (*VCursorImpl) GetExecutionMetrics

func (vc *VCursorImpl) GetExecutionMetrics() *engine.Metrics

GetExecutionMetrics provides the execution metrics object.

func (*VCursorImpl) GetForeignKeyChecksState

func (vc *VCursorImpl) GetForeignKeyChecksState() *bool

GetForeignKeyChecksState gets the stored foreign key checks state in the vcursor.

func (*VCursorImpl) GetKeyspace

func (vc *VCursorImpl) GetKeyspace() string

func (*VCursorImpl) GetMarginComments

func (vc *VCursorImpl) GetMarginComments() sqlparser.MarginComments

func (*VCursorImpl) GetMigrationContext

func (vc *VCursorImpl) GetMigrationContext() string

GetMigrationContext implements the SessionActions interface

func (*VCursorImpl) GetPrepareData

func (vc *VCursorImpl) GetPrepareData(stmtName string) *vtgatepb.PrepareData

func (*VCursorImpl) GetSafeSession

func (vc *VCursorImpl) GetSafeSession() *SafeSession

func (*VCursorImpl) GetSemTable

func (vc *VCursorImpl) GetSemTable() *semantics.SemTable

GetSemTable implements the ContextVSchema interface

func (*VCursorImpl) GetSessionEnableSystemSettings

func (vc *VCursorImpl) GetSessionEnableSystemSettings() bool

GetSessionEnableSystemSettings implements the SessionActions interface

func (*VCursorImpl) GetSessionUUID

func (vc *VCursorImpl) GetSessionUUID() string

GetSessionUUID implements the SessionActions interface

func (*VCursorImpl) GetSrvVschema

func (vc *VCursorImpl) GetSrvVschema() *vschemapb.SrvVSchema

func (*VCursorImpl) GetSystemVariables

func (vc *VCursorImpl) GetSystemVariables(f func(k string, v string))

GetSystemVariables takes a visitor function that will save each system variables of the session

func (*VCursorImpl) GetSystemVariablesCopy

func (vc *VCursorImpl) GetSystemVariablesCopy() map[string]string

GetSystemVariablesCopy returns a copy of the system variables of the session. Changes to the original map will not affect the session.

func (*VCursorImpl) GetUDV

func (vc *VCursorImpl) GetUDV(name string) *querypb.BindVariable

func (*VCursorImpl) GetVExplainLogs

func (vc *VCursorImpl) GetVExplainLogs() []engine.ExecuteEntry

func (*VCursorImpl) GetVSchema

func (vc *VCursorImpl) GetVSchema() *vindexes.VSchema

func (*VCursorImpl) GetWarmingReadsChannel

func (vc *VCursorImpl) GetWarmingReadsChannel() chan bool

func (*VCursorImpl) GetWarmingReadsPercent

func (vc *VCursorImpl) GetWarmingReadsPercent() int

func (*VCursorImpl) GetWarnings

func (vc *VCursorImpl) GetWarnings() []*querypb.QueryWarning

GetWarnings implements the SessionActions interface

func (*VCursorImpl) HasCreatedTempTable

func (vc *VCursorImpl) HasCreatedTempTable()

HasCreatedTempTable implements the SessionActions interface

func (*VCursorImpl) HasSystemVariables

func (vc *VCursorImpl) HasSystemVariables() bool

HasSystemVariables returns whether the session has set system variables or not

func (*VCursorImpl) IgnoreMaxMemoryRows

func (vc *VCursorImpl) IgnoreMaxMemoryRows() bool

func (*VCursorImpl) InReservedConn

func (vc *VCursorImpl) InReservedConn() bool

func (*VCursorImpl) InTransaction

func (vc *VCursorImpl) InTransaction() bool

func (*VCursorImpl) InTransactionAndIsDML

func (vc *VCursorImpl) InTransactionAndIsDML() bool

func (*VCursorImpl) IsShardRoutingEnabled

func (vc *VCursorImpl) IsShardRoutingEnabled() bool

IsShardRoutingEnabled implements the VCursor interface.

func (*VCursorImpl) IsViewsEnabled

func (vc *VCursorImpl) IsViewsEnabled() bool

func (*VCursorImpl) KeyspaceAvailable

func (vc *VCursorImpl) KeyspaceAvailable(ks string) bool

KeyspaceAvailable implements the VCursor interface

func (*VCursorImpl) KeyspaceError

func (vc *VCursorImpl) KeyspaceError(keyspace string) error

func (*VCursorImpl) KeyspaceExists

func (vc *VCursorImpl) KeyspaceExists(ks string) bool

KeyspaceExists provides whether the keyspace exists or not.

func (*VCursorImpl) LookupRowLockShardSession

func (vc *VCursorImpl) LookupRowLockShardSession() vtgatepb.CommitOrder

func (*VCursorImpl) MaxMemoryRows

func (vc *VCursorImpl) MaxMemoryRows() int

MaxMemoryRows returns the maxMemoryRows flag value.

func (*VCursorImpl) MessageStream

func (vc *VCursorImpl) MessageStream(ctx context.Context, rss []*srvtopo.ResolvedShard, tableName string, callback func(*sqltypes.Result) error) error

func (*VCursorImpl) NeedsReservedConn

func (vc *VCursorImpl) NeedsReservedConn()

NeedsReservedConn implements the SessionActions interface

func (*VCursorImpl) PlanPrepareStatement

func (vc *VCursorImpl) PlanPrepareStatement(ctx context.Context, query string) (*engine.Plan, error)

func (*VCursorImpl) Planner

func (vc *VCursorImpl) Planner() plancontext.PlannerVersion

Planner implements the ContextVSchema interface

func (*VCursorImpl) PlannerWarning

func (vc *VCursorImpl) PlannerWarning(message string)

PlannerWarning implements the VCursor interface

func (*VCursorImpl) PrepareSetVarComment

func (vc *VCursorImpl) PrepareSetVarComment() string

func (*VCursorImpl) ReadTransaction

func (vc *VCursorImpl) ReadTransaction(ctx context.Context, transactionID string) (*querypb.TransactionMetadata, error)

func (*VCursorImpl) RecordMirrorStats

func (vc *VCursorImpl) RecordMirrorStats(sourceExecTime, targetExecTime time.Duration, targetErr error)

RecordMirrorStats is used to record stats about a mirror query.

func (*VCursorImpl) RecordWarning

func (vc *VCursorImpl) RecordWarning(warning *querypb.QueryWarning)

RecordWarning stores the given warning in the current session

func (*VCursorImpl) ReleaseLock

func (vc *VCursorImpl) ReleaseLock(ctx context.Context) error

func (*VCursorImpl) RemoveAdvisoryLock

func (vc *VCursorImpl) RemoveAdvisoryLock(name string)

RemoveAdvisoryLock implements the SessionActions interface

func (*VCursorImpl) ResolveDestinations

func (vc *VCursorImpl) ResolveDestinations(ctx context.Context, keyspace string, ids []*querypb.Value, destinations []key.ShardDestination) ([]*srvtopo.ResolvedShard, [][]*querypb.Value, error)

func (*VCursorImpl) ResolveDestinationsMultiCol

func (vc *VCursorImpl) ResolveDestinationsMultiCol(ctx context.Context, keyspace string, ids [][]sqltypes.Value, destinations []key.ShardDestination) ([]*srvtopo.ResolvedShard, [][][]sqltypes.Value, error)

func (*VCursorImpl) SQLMode

func (vc *VCursorImpl) SQLMode() string

func (*VCursorImpl) SelectedKeyspace

func (vc *VCursorImpl) SelectedKeyspace() (*vindexes.Keyspace, error)

SelectedKeyspace returns the selected keyspace of the current request if there is one. If the keyspace specified in the target cannot be identified, it returns an error.

func (*VCursorImpl) Session

func (vc *VCursorImpl) Session() engine.SessionActions

func (*VCursorImpl) SetAutocommit

func (vc *VCursorImpl) SetAutocommit(ctx context.Context, autocommit bool) error

SetAutocommit implements the SessionActions interface

func (*VCursorImpl) SetBindVars

func (vc *VCursorImpl) SetBindVars(m map[string]*querypb.BindVariable)

func (*VCursorImpl) SetClientFoundRows

func (vc *VCursorImpl) SetClientFoundRows(_ context.Context, clientFoundRows bool) error

SetClientFoundRows implements the SessionActions interface

func (*VCursorImpl) SetCommitOrder

func (vc *VCursorImpl) SetCommitOrder(co vtgatepb.CommitOrder)

func (*VCursorImpl) SetConsolidator

func (vc *VCursorImpl) SetConsolidator(consolidator querypb.ExecuteOptions_Consolidator)

SetConsolidator implements the SessionActions interface

func (*VCursorImpl) SetDDLStrategy

func (vc *VCursorImpl) SetDDLStrategy(strategy string)

SetDDLStrategy implements the SessionActions interface

func (*VCursorImpl) SetExec

func (vc *VCursorImpl) SetExec(ctx context.Context, name string, value string) error

func (*VCursorImpl) SetExecQueryTimeout

func (vc *VCursorImpl) SetExecQueryTimeout(timeout *int)

func (*VCursorImpl) SetForeignKeyCheckState

func (vc *VCursorImpl) SetForeignKeyCheckState(fkChecksState *bool)

SetForeignKeyCheckState updates the foreign key checks state of the vcursor.

func (*VCursorImpl) SetFoundRows

func (vc *VCursorImpl) SetFoundRows(foundRows uint64)

SetFoundRows implements the SessionActions interface

func (*VCursorImpl) SetIgnoreMaxMemoryRows

func (vc *VCursorImpl) SetIgnoreMaxMemoryRows(ignoreMaxMemoryRows bool)

SetIgnoreMaxMemoryRows sets the ignoreMaxMemoryRows value.

func (*VCursorImpl) SetInDMLExecution

func (vc *VCursorImpl) SetInDMLExecution(inDMLExec bool)

SetInDMLExecution implements the SessionActions interface

func (*VCursorImpl) SetLastInsertID

func (vc *VCursorImpl) SetLastInsertID(id uint64)

func (*VCursorImpl) SetMigrationContext

func (vc *VCursorImpl) SetMigrationContext(migrationContext string)

SetMigrationContext implements the SessionActions interface

func (*VCursorImpl) SetPlannerVersion

func (vc *VCursorImpl) SetPlannerVersion(v plancontext.PlannerVersion)

SetPlannerVersion implements the SessionActions interface

func (*VCursorImpl) SetPriority

func (vc *VCursorImpl) SetPriority(priority string)

func (*VCursorImpl) SetQueryTimeout

func (vc *VCursorImpl) SetQueryTimeout(maxExecutionTime int64)

SetQueryTimeout implements the SessionActions interface

func (*VCursorImpl) SetReadAfterWriteGTID

func (vc *VCursorImpl) SetReadAfterWriteGTID(vtgtid string)

SetReadAfterWriteGTID implements the SessionActions interface

func (*VCursorImpl) SetReadAfterWriteTimeout

func (vc *VCursorImpl) SetReadAfterWriteTimeout(timeout float64)

SetReadAfterWriteTimeout implements the SessionActions interface

func (*VCursorImpl) SetSQLSelectLimit

func (vc *VCursorImpl) SetSQLSelectLimit(limit int64) error

SetSQLSelectLimit implements the SessionActions interface

func (*VCursorImpl) SetSessionEnableSystemSettings

func (vc *VCursorImpl) SetSessionEnableSystemSettings(_ context.Context, allow bool) error

SetSessionEnableSystemSettings implements the SessionActions interface

func (*VCursorImpl) SetSessionTrackGTIDs

func (vc *VCursorImpl) SetSessionTrackGTIDs(enable bool)

SetSessionTrackGTIDs implements the SessionActions interface

func (*VCursorImpl) SetSkipQueryPlanCache

func (vc *VCursorImpl) SetSkipQueryPlanCache(_ context.Context, skipQueryPlanCache bool) error

SetSkipQueryPlanCache implements the SessionActions interface

func (*VCursorImpl) SetSysVar

func (vc *VCursorImpl) SetSysVar(name string, expr string)

func (*VCursorImpl) SetTarget

func (vc *VCursorImpl) SetTarget(target string) error

func (*VCursorImpl) SetTransactionMode

func (vc *VCursorImpl) SetTransactionMode(mode vtgatepb.TransactionMode)

SetTransactionMode implements the SessionActions interface

func (*VCursorImpl) SetUDV

func (vc *VCursorImpl) SetUDV(key string, value any) error

func (*VCursorImpl) SetWorkload

func (vc *VCursorImpl) SetWorkload(workload querypb.ExecuteOptions_Workload)

SetWorkload implements the SessionActions interface

func (*VCursorImpl) SetWorkloadName

func (vc *VCursorImpl) SetWorkloadName(workloadName string)

func (*VCursorImpl) ShardDestination

func (vc *VCursorImpl) ShardDestination() key.ShardDestination

Destination implements the ContextVSchema interface

func (*VCursorImpl) ShardSession

func (vc *VCursorImpl) ShardSession() []*srvtopo.ResolvedShard

func (*VCursorImpl) ShowExec

func (vc *VCursorImpl) ShowExec(ctx context.Context, command sqlparser.ShowCommandType, filter *sqlparser.ShowFilter) (*sqltypes.Result, error)

func (*VCursorImpl) StartPrimitiveTrace

func (vc *VCursorImpl) StartPrimitiveTrace() func() engine.Stats

func (*VCursorImpl) StorePrepareData

func (vc *VCursorImpl) StorePrepareData(stmtName string, prepareData *vtgatepb.PrepareData)

func (*VCursorImpl) StreamExecuteMulti

func (vc *VCursorImpl) StreamExecuteMulti(ctx context.Context, primitive engine.Primitive, query string, rss []*srvtopo.ResolvedShard, bindVars []map[string]*querypb.BindVariable, rollbackOnError, autocommit, fetchLastInsertID bool, callback func(reply *sqltypes.Result) error) []error

StreamExecuteMulti is the streaming version of ExecuteMultiShard.

func (*VCursorImpl) StreamExecutePrimitive

func (vc *VCursorImpl) StreamExecutePrimitive(ctx context.Context, primitive engine.Primitive, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

func (*VCursorImpl) StreamExecutePrimitiveStandalone

func (vc *VCursorImpl) StreamExecutePrimitiveStandalone(ctx context.Context, primitive engine.Primitive, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(result *sqltypes.Result) error) error

func (*VCursorImpl) SysVarSetEnabled

func (vc *VCursorImpl) SysVarSetEnabled() bool

SysVarSetEnabled implements the ContextVSchema interface

func (*VCursorImpl) TabletType

func (vc *VCursorImpl) TabletType() topodatapb.TabletType

TabletType implements the ContextVSchema interface

func (*VCursorImpl) TargetDestination

func (vc *VCursorImpl) TargetDestination(qualifier string) (key.ShardDestination, *vindexes.Keyspace, topodatapb.TabletType, error)

TargetDestination implements the ContextVSchema interface

func (*VCursorImpl) TargetString

func (vc *VCursorImpl) TargetString() string

TargetString returns the current TargetString of the session.

func (*VCursorImpl) ThrottleApp

func (vc *VCursorImpl) ThrottleApp(ctx context.Context, throttledAppRule *topodatapb.ThrottledAppRule) (err error)

func (*VCursorImpl) TimeZone

func (vc *VCursorImpl) TimeZone() *time.Location

func (*VCursorImpl) UnresolvedTransactions

func (vc *VCursorImpl) UnresolvedTransactions(ctx context.Context, keyspace string) ([]*querypb.TransactionMetadata, error)

UnresolvedTransactions gets the unresolved transactions for the given keyspace. If the keyspace is not given, then we use the default keyspace.

func (*VCursorImpl) VExplainLogging

func (vc *VCursorImpl) VExplainLogging()

func (*VCursorImpl) VStream

func (vc *VCursorImpl) VStream(ctx context.Context, rss []*srvtopo.ResolvedShard, filter *binlogdatapb.Filter, gtid string, callback func(evs []*binlogdatapb.VEvent) error) error

func (*VCursorImpl) WarnUnshardedOnly

func (vc *VCursorImpl) WarnUnshardedOnly(format string, params ...any)

WarnUnshardedOnly implements the VCursor interface

type VSchemaOperator

type VSchemaOperator interface {
	GetCurrentSrvVschema() *vschemapb.SrvVSchema
	UpdateVSchema(ctx context.Context, ks *topo.KeyspaceVSchemaInfo, vschema *vschemapb.SrvVSchema) error
}

VSchemaOperator is an interface to Vschema Operations

Jump to

Keyboard shortcuts

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