Documentation ¶
Index ¶
- func NeedSetRCCheckTSFlag(ctx sessionctx.Context, node ast.Node) bool
- type OptimisticTxnContextProvider
- func (p *OptimisticTxnContextProvider) ActivateTxn() (kv.Transaction, error)
- func (p *OptimisticTxnContextProvider) AdviseOptimizeWithPlan(plan interface{}) (err error)
- func (p *OptimisticTxnContextProvider) AdviseWarmup() error
- func (p *OptimisticTxnContextProvider) GetReadReplicaScope() string
- func (p *OptimisticTxnContextProvider) GetSnapshotWithStmtForUpdateTS() (kv.Snapshot, error)
- func (p *OptimisticTxnContextProvider) GetSnapshotWithStmtReadTS() (kv.Snapshot, error)
- func (p *OptimisticTxnContextProvider) GetStmtForUpdateTS() (uint64, error)
- func (p *OptimisticTxnContextProvider) GetStmtReadTS() (uint64, error)
- func (p *OptimisticTxnContextProvider) GetTxnInfoSchema() infoschema.InfoSchema
- func (p *OptimisticTxnContextProvider) GetTxnScope() string
- func (p *OptimisticTxnContextProvider) OnInitialize(ctx context.Context, tp sessiontxn.EnterNewTxnType) (err error)
- func (p *OptimisticTxnContextProvider) OnLocalTemporaryTableCreated()
- func (p *OptimisticTxnContextProvider) OnPessimisticStmtEnd(_ context.Context, _ bool) error
- func (p *OptimisticTxnContextProvider) OnPessimisticStmtStart(_ context.Context) error
- func (p *OptimisticTxnContextProvider) OnStmtCommit(_ context.Context) error
- func (p *OptimisticTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
- func (p *OptimisticTxnContextProvider) OnStmtRetry(ctx context.Context) error
- func (p *OptimisticTxnContextProvider) OnStmtRollback(_ context.Context, _ bool) error
- func (p *OptimisticTxnContextProvider) OnStmtStart(ctx context.Context, _ ast.StmtNode) error
- func (p *OptimisticTxnContextProvider) ResetForNewTxn(sctx sessionctx.Context, causalConsistencyOnly bool)
- func (p *OptimisticTxnContextProvider) SetTxnInfoSchema(is infoschema.InfoSchema)
- type PessimisticRCTxnContextProvider
- func (p *PessimisticRCTxnContextProvider) AdviseOptimizeWithPlan(val interface{}) (err error)
- func (p *PessimisticRCTxnContextProvider) AdviseWarmup() error
- func (p *PessimisticRCTxnContextProvider) GetSnapshotWithStmtForUpdateTS() (kv.Snapshot, error)
- func (p *PessimisticRCTxnContextProvider) GetSnapshotWithStmtReadTS() (kv.Snapshot, error)
- func (p *PessimisticRCTxnContextProvider) IsCheckTSInWriteStmtMode() bool
- func (p *PessimisticRCTxnContextProvider) OnPessimisticStmtEnd(ctx context.Context, isSuccessful bool) error
- func (p *PessimisticRCTxnContextProvider) OnPessimisticStmtStart(ctx context.Context) error
- func (p *PessimisticRCTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
- func (p *PessimisticRCTxnContextProvider) OnStmtRetry(ctx context.Context) error
- func (p *PessimisticRCTxnContextProvider) OnStmtStart(ctx context.Context, node ast.StmtNode) error
- type PessimisticRRTxnContextProvider
- func (p *PessimisticRRTxnContextProvider) AdviseOptimizeWithPlan(val interface{}) (err error)
- func (p *PessimisticRRTxnContextProvider) OnPessimisticStmtEnd(ctx context.Context, isSuccessful bool) error
- func (p *PessimisticRRTxnContextProvider) OnPessimisticStmtStart(ctx context.Context) error
- func (p *PessimisticRRTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
- func (p *PessimisticRRTxnContextProvider) OnStmtRetry(ctx context.Context) (err error)
- func (p *PessimisticRRTxnContextProvider) OnStmtStart(ctx context.Context, node ast.StmtNode) error
- type PessimisticSerializableTxnContextProvider
- func (p *PessimisticSerializableTxnContextProvider) ActivateTxn() (kv.Transaction, error)
- func (p *PessimisticSerializableTxnContextProvider) AdviseOptimizeWithPlan(_ interface{}) error
- func (p *PessimisticSerializableTxnContextProvider) AdviseWarmup() error
- func (p *PessimisticSerializableTxnContextProvider) GetReadReplicaScope() string
- func (p *PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtForUpdateTS() (kv.Snapshot, error)
- func (p *PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtReadTS() (kv.Snapshot, error)
- func (p *PessimisticSerializableTxnContextProvider) GetStmtForUpdateTS() (uint64, error)
- func (p *PessimisticSerializableTxnContextProvider) GetStmtReadTS() (uint64, error)
- func (p *PessimisticSerializableTxnContextProvider) GetTxnInfoSchema() infoschema.InfoSchema
- func (p *PessimisticSerializableTxnContextProvider) GetTxnScope() string
- func (p *PessimisticSerializableTxnContextProvider) OnInitialize(ctx context.Context, tp sessiontxn.EnterNewTxnType) (err error)
- func (p *PessimisticSerializableTxnContextProvider) OnLocalTemporaryTableCreated()
- func (p *PessimisticSerializableTxnContextProvider) OnPessimisticStmtEnd(_ context.Context, _ bool) error
- func (p *PessimisticSerializableTxnContextProvider) OnPessimisticStmtStart(_ context.Context) error
- func (p *PessimisticSerializableTxnContextProvider) OnStmtCommit(_ context.Context) error
- func (p *PessimisticSerializableTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
- func (p *PessimisticSerializableTxnContextProvider) OnStmtRetry(ctx context.Context) error
- func (p *PessimisticSerializableTxnContextProvider) OnStmtRollback(_ context.Context, _ bool) error
- func (p *PessimisticSerializableTxnContextProvider) OnStmtStart(ctx context.Context, _ ast.StmtNode) error
- func (p *PessimisticSerializableTxnContextProvider) SetTxnInfoSchema(is infoschema.InfoSchema)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NeedSetRCCheckTSFlag ¶
func NeedSetRCCheckTSFlag(ctx sessionctx.Context, node ast.Node) bool
NeedSetRCCheckTSFlag checks whether it's needed to set `RCCheckTS` flag in current stmtctx.
Types ¶
type OptimisticTxnContextProvider ¶
type OptimisticTxnContextProvider struct {
// contains filtered or unexported fields
}
OptimisticTxnContextProvider provides txn context for optimistic transaction
func (*OptimisticTxnContextProvider) ActivateTxn ¶
func (p *OptimisticTxnContextProvider) ActivateTxn() (kv.Transaction, error)
ActivateTxn activates the transaction and set the relevant context variables.
func (*OptimisticTxnContextProvider) AdviseOptimizeWithPlan ¶
func (p *OptimisticTxnContextProvider) AdviseOptimizeWithPlan(plan interface{}) (err error)
AdviseOptimizeWithPlan providers optimization according to the plan It will use MaxTS as the startTS in autocommit txn for some plans.
func (*OptimisticTxnContextProvider) AdviseWarmup ¶
func (p *OptimisticTxnContextProvider) AdviseWarmup() error
AdviseWarmup provides warmup for inner state
func (*OptimisticTxnContextProvider) GetReadReplicaScope ¶
func (p *OptimisticTxnContextProvider) GetReadReplicaScope() string
GetReadReplicaScope returns the read replica scope
func (*OptimisticTxnContextProvider) GetSnapshotWithStmtForUpdateTS ¶
GetSnapshotWithStmtForUpdateTS gets snapshot with for update ts
func (*OptimisticTxnContextProvider) GetSnapshotWithStmtReadTS ¶
GetSnapshotWithStmtReadTS gets snapshot with read ts
func (*OptimisticTxnContextProvider) GetStmtForUpdateTS ¶
func (p *OptimisticTxnContextProvider) GetStmtForUpdateTS() (uint64, error)
GetStmtForUpdateTS returns the read timestamp used by select statement (not for select ... for update)
func (*OptimisticTxnContextProvider) GetStmtReadTS ¶
func (p *OptimisticTxnContextProvider) GetStmtReadTS() (uint64, error)
GetStmtReadTS returns the read timestamp used by select statement (not for select ... for update)
func (*OptimisticTxnContextProvider) GetTxnInfoSchema ¶
func (p *OptimisticTxnContextProvider) GetTxnInfoSchema() infoschema.InfoSchema
GetTxnInfoSchema returns the information schema used by txn
func (*OptimisticTxnContextProvider) GetTxnScope ¶
func (p *OptimisticTxnContextProvider) GetTxnScope() string
GetTxnScope returns the current txn scope
func (*OptimisticTxnContextProvider) OnInitialize ¶
func (p *OptimisticTxnContextProvider) OnInitialize(ctx context.Context, tp sessiontxn.EnterNewTxnType) (err error)
OnInitialize is the hook that should be called when enter a new txn with this provider
func (*OptimisticTxnContextProvider) OnLocalTemporaryTableCreated ¶
func (p *OptimisticTxnContextProvider) OnLocalTemporaryTableCreated()
OnLocalTemporaryTableCreated is the hook that should be called when a local temporary table created.
func (*OptimisticTxnContextProvider) OnPessimisticStmtEnd ¶
OnPessimisticStmtEnd is the hook that should be called when finishes handling a pessimistic DML or select-for-update statement.
func (*OptimisticTxnContextProvider) OnPessimisticStmtStart ¶
OnPessimisticStmtStart is the hook that should be called when starts handling a pessimistic DML or a pessimistic select-for-update statements.
func (*OptimisticTxnContextProvider) OnStmtCommit ¶
OnStmtCommit is the hook that should be called when a statement is executed successfully.
func (*OptimisticTxnContextProvider) OnStmtErrorForNextAction ¶
func (p *OptimisticTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
OnStmtErrorForNextAction is the hook that should be called when a new statement get an error
func (*OptimisticTxnContextProvider) OnStmtRetry ¶
OnStmtRetry is the hook that should be called when a statement is retried internally.
func (*OptimisticTxnContextProvider) OnStmtRollback ¶
OnStmtRollback is the hook that should be called when a statement fails to execute.
func (*OptimisticTxnContextProvider) OnStmtStart ¶
OnStmtStart is the hook that should be called when a new statement started
func (*OptimisticTxnContextProvider) ResetForNewTxn ¶
func (p *OptimisticTxnContextProvider) ResetForNewTxn(sctx sessionctx.Context, causalConsistencyOnly bool)
ResetForNewTxn resets OptimisticTxnContextProvider to an initial state for a new txn
func (*OptimisticTxnContextProvider) SetTxnInfoSchema ¶
func (p *OptimisticTxnContextProvider) SetTxnInfoSchema(is infoschema.InfoSchema)
type PessimisticRCTxnContextProvider ¶
type PessimisticRCTxnContextProvider struct {
// contains filtered or unexported fields
}
PessimisticRCTxnContextProvider provides txn context for isolation level read-committed
func NewPessimisticRCTxnContextProvider ¶
func NewPessimisticRCTxnContextProvider(sctx sessionctx.Context, causalConsistencyOnly bool) *PessimisticRCTxnContextProvider
NewPessimisticRCTxnContextProvider returns a new PessimisticRCTxnContextProvider
func (*PessimisticRCTxnContextProvider) AdviseOptimizeWithPlan ¶
func (p *PessimisticRCTxnContextProvider) AdviseOptimizeWithPlan(val interface{}) (err error)
AdviseOptimizeWithPlan in read-committed covers as many cases as repeatable-read. We do not fetch latest ts immediately for such scenes. 1. A query like the form of "SELECT ... FOR UPDATE" whose execution plan is "PointGet". 2. An INSERT statement without "SELECT" subquery. 3. A UPDATE statement whose sub execution plan is "PointGet". 4. A DELETE statement whose sub execution plan is "PointGet".
func (*PessimisticRCTxnContextProvider) AdviseWarmup ¶
func (p *PessimisticRCTxnContextProvider) AdviseWarmup() error
AdviseWarmup provides warmup for inner state
func (*PessimisticRCTxnContextProvider) GetSnapshotWithStmtForUpdateTS ¶
func (p *PessimisticRCTxnContextProvider) GetSnapshotWithStmtForUpdateTS() (kv.Snapshot, error)
GetSnapshotWithStmtForUpdateTS gets snapshot with for update ts
func (*PessimisticRCTxnContextProvider) GetSnapshotWithStmtReadTS ¶
func (p *PessimisticRCTxnContextProvider) GetSnapshotWithStmtReadTS() (kv.Snapshot, error)
GetSnapshotWithStmtReadTS gets snapshot with read ts
func (*PessimisticRCTxnContextProvider) IsCheckTSInWriteStmtMode ¶
func (p *PessimisticRCTxnContextProvider) IsCheckTSInWriteStmtMode() bool
IsCheckTSInWriteStmtMode is only used for test
func (*PessimisticRCTxnContextProvider) OnPessimisticStmtEnd ¶
func (p *PessimisticRCTxnContextProvider) OnPessimisticStmtEnd(ctx context.Context, isSuccessful bool) error
OnPessimisticStmtEnd is the hook that should be called when finishes handling a pessimistic DML or select-for-update statement.
func (*PessimisticRCTxnContextProvider) OnPessimisticStmtStart ¶
OnPessimisticStmtStart is the hook that should be called when starts handling a pessimistic DML or a pessimistic select-for-update statements.
func (*PessimisticRCTxnContextProvider) OnStmtErrorForNextAction ¶
func (p *PessimisticRCTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
OnStmtErrorForNextAction is the hook that should be called when a new statement get an error
func (*PessimisticRCTxnContextProvider) OnStmtRetry ¶
func (p *PessimisticRCTxnContextProvider) OnStmtRetry(ctx context.Context) error
OnStmtRetry is the hook that should be called when a statement is retried internally.
func (*PessimisticRCTxnContextProvider) OnStmtStart ¶
OnStmtStart is the hook that should be called when a new statement started
type PessimisticRRTxnContextProvider ¶
type PessimisticRRTxnContextProvider struct {
// contains filtered or unexported fields
}
PessimisticRRTxnContextProvider provides txn context for isolation level repeatable-read
func NewPessimisticRRTxnContextProvider ¶
func NewPessimisticRRTxnContextProvider(sctx sessionctx.Context, causalConsistencyOnly bool) *PessimisticRRTxnContextProvider
NewPessimisticRRTxnContextProvider returns a new PessimisticRRTxnContextProvider
func (*PessimisticRRTxnContextProvider) AdviseOptimizeWithPlan ¶
func (p *PessimisticRRTxnContextProvider) AdviseOptimizeWithPlan(val interface{}) (err error)
AdviseOptimizeWithPlan optimizes for update point get related execution. Use case: In for update point get related operations, we do not fetch ts from PD but use the last ts we fetched.
We expect that the data that the point get acquires has not been changed.
Benefit: Save the cost of acquiring ts from PD. Drawbacks: If the data has been changed since the ts we used, we need to retry. One exception is insert operation, when it has no select plan, we do not fetch the latest ts immediately. We only update ts if write conflict is incurred.
func (*PessimisticRRTxnContextProvider) OnPessimisticStmtEnd ¶
func (p *PessimisticRRTxnContextProvider) OnPessimisticStmtEnd(ctx context.Context, isSuccessful bool) error
OnPessimisticStmtEnd is the hook that should be called when finishes handling a pessimistic DML or select-for-update statement.
func (*PessimisticRRTxnContextProvider) OnPessimisticStmtStart ¶
OnPessimisticStmtStart is the hook that should be called when starts handling a pessimistic DML or a pessimistic select-for-update statements.
func (*PessimisticRRTxnContextProvider) OnStmtErrorForNextAction ¶
func (p *PessimisticRRTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
OnStmtErrorForNextAction is the hook that should be called when a new statement get an error
func (*PessimisticRRTxnContextProvider) OnStmtRetry ¶
func (p *PessimisticRRTxnContextProvider) OnStmtRetry(ctx context.Context) (err error)
OnStmtRetry is the hook that should be called when a statement is retried internally.
func (*PessimisticRRTxnContextProvider) OnStmtStart ¶
OnStmtStart is the hook that should be called when a new statement started
type PessimisticSerializableTxnContextProvider ¶
type PessimisticSerializableTxnContextProvider struct {
// contains filtered or unexported fields
}
PessimisticSerializableTxnContextProvider provides txn context for isolation level oracle-like serializable
func NewPessimisticSerializableTxnContextProvider ¶
func NewPessimisticSerializableTxnContextProvider(sctx sessionctx.Context, causalConsistencyOnly bool) *PessimisticSerializableTxnContextProvider
NewPessimisticSerializableTxnContextProvider returns a new PessimisticSerializableTxnContextProvider
func (*PessimisticSerializableTxnContextProvider) ActivateTxn ¶
func (p *PessimisticSerializableTxnContextProvider) ActivateTxn() (kv.Transaction, error)
ActivateTxn activates the transaction and set the relevant context variables.
func (*PessimisticSerializableTxnContextProvider) AdviseOptimizeWithPlan ¶
func (p *PessimisticSerializableTxnContextProvider) AdviseOptimizeWithPlan(_ interface{}) error
AdviseOptimizeWithPlan providers optimization according to the plan
func (*PessimisticSerializableTxnContextProvider) AdviseWarmup ¶
func (p *PessimisticSerializableTxnContextProvider) AdviseWarmup() error
AdviseWarmup provides warmup for inner state
func (*PessimisticSerializableTxnContextProvider) GetReadReplicaScope ¶
func (p *PessimisticSerializableTxnContextProvider) GetReadReplicaScope() string
GetReadReplicaScope returns the read replica scope
func (*PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtForUpdateTS ¶
func (p *PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtForUpdateTS() (kv.Snapshot, error)
GetSnapshotWithStmtForUpdateTS gets snapshot with for update ts
func (*PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtReadTS ¶
func (p *PessimisticSerializableTxnContextProvider) GetSnapshotWithStmtReadTS() (kv.Snapshot, error)
GetSnapshotWithStmtReadTS gets snapshot with read ts
func (*PessimisticSerializableTxnContextProvider) GetStmtForUpdateTS ¶
GetStmtForUpdateTS returns the read timestamp used by update/insert/delete or select ... for update
func (*PessimisticSerializableTxnContextProvider) GetStmtReadTS ¶
GetStmtReadTS returns the read timestamp used by select statement (not for select ... for update)
func (*PessimisticSerializableTxnContextProvider) GetTxnInfoSchema ¶
func (p *PessimisticSerializableTxnContextProvider) GetTxnInfoSchema() infoschema.InfoSchema
GetTxnInfoSchema returns the information schema used by txn
func (*PessimisticSerializableTxnContextProvider) GetTxnScope ¶
func (p *PessimisticSerializableTxnContextProvider) GetTxnScope() string
GetTxnScope returns the current txn scope
func (*PessimisticSerializableTxnContextProvider) OnInitialize ¶
func (p *PessimisticSerializableTxnContextProvider) OnInitialize(ctx context.Context, tp sessiontxn.EnterNewTxnType) (err error)
OnInitialize is the hook that should be called when enter a new txn with this provider
func (*PessimisticSerializableTxnContextProvider) OnLocalTemporaryTableCreated ¶
func (p *PessimisticSerializableTxnContextProvider) OnLocalTemporaryTableCreated()
OnLocalTemporaryTableCreated is the hook that should be called when a local temporary table created.
func (*PessimisticSerializableTxnContextProvider) OnPessimisticStmtEnd ¶
func (p *PessimisticSerializableTxnContextProvider) OnPessimisticStmtEnd(_ context.Context, _ bool) error
OnPessimisticStmtEnd is the hook that should be called when finishes handling a pessimistic DML or select-for-update statement.
func (*PessimisticSerializableTxnContextProvider) OnPessimisticStmtStart ¶
OnPessimisticStmtStart is the hook that should be called when starts handling a pessimistic DML or a pessimistic select-for-update statements.
func (*PessimisticSerializableTxnContextProvider) OnStmtCommit ¶
OnStmtCommit is the hook that should be called when a statement is executed successfully.
func (*PessimisticSerializableTxnContextProvider) OnStmtErrorForNextAction ¶
func (p *PessimisticSerializableTxnContextProvider) OnStmtErrorForNextAction(ctx context.Context, point sessiontxn.StmtErrorHandlePoint, err error) (sessiontxn.StmtErrorAction, error)
OnStmtErrorForNextAction is the hook that should be called when a new statement get an error
func (*PessimisticSerializableTxnContextProvider) OnStmtRetry ¶
OnStmtRetry is the hook that should be called when a statement is retried internally.
func (*PessimisticSerializableTxnContextProvider) OnStmtRollback ¶
OnStmtRollback is the hook that should be called when a statement fails to execute.
func (*PessimisticSerializableTxnContextProvider) OnStmtStart ¶
func (p *PessimisticSerializableTxnContextProvider) OnStmtStart(ctx context.Context, _ ast.StmtNode) error
OnStmtStart is the hook that should be called when a new statement started
func (*PessimisticSerializableTxnContextProvider) SetTxnInfoSchema ¶
func (p *PessimisticSerializableTxnContextProvider) SetTxnInfoSchema(is infoschema.InfoSchema)