Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
  • Loading branch information
SpadeA-Tang committed Jul 1, 2022
1 parent ee44d7e commit ffb32d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
28 changes: 2 additions & 26 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ func (b *executorBuilder) getSnapshotTS() (uint64, error) {

// getSnapshot get the appropriate snapshot from txnManager and set
// the relevant snapshot options before return.
func (b *executorBuilder) getSnapshot(e Executor) (kv.Snapshot, error) {
func (b *executorBuilder) getSnapshot() (kv.Snapshot, error) {
var snapshot kv.Snapshot
var err error

Expand All @@ -1548,30 +1548,6 @@ func (b *executorBuilder) getSnapshot(e Executor) (kv.Snapshot, error) {
}

sessVars := b.ctx.GetSessionVars()

switch v := e.(type) {
case *BatchPointGetExec:
if v.runtimeStats != nil {
snapshotStats := &txnsnapshot.SnapshotRuntimeStats{}
v.stats = &runtimeStatsWithSnapshot{
SnapshotRuntimeStats: snapshotStats,
}
snapshot.SetOption(kv.CollectRuntimeStats, snapshotStats)
sessVars.StmtCtx.RuntimeStatsColl.RegisterStats(v.id, v.stats)
}
case *PointGetExecutor:
if v.runtimeStats != nil {
snapshotStats := &txnsnapshot.SnapshotRuntimeStats{}
v.stats = &runtimeStatsWithSnapshot{
SnapshotRuntimeStats: snapshotStats,
}
snapshot.SetOption(kv.CollectRuntimeStats, snapshotStats)
sessVars.StmtCtx.RuntimeStatsColl.RegisterStats(v.id, v.stats)
}
default:
return nil, errors.New("Mismatched executor")
}

replicaReadType := sessVars.GetReplicaRead()
snapshot.SetOption(kv.ReadReplicaScope, b.readReplicaScope)
snapshot.SetOption(kv.TaskID, sessVars.StmtCtx.TaskID)
Expand Down Expand Up @@ -4639,7 +4615,7 @@ func (b *executorBuilder) buildBatchPointGet(plan *plannercore.BatchPointGetPlan
columns: plan.Columns,
}

e.snapshot, err = b.getSnapshot(e)
e.snapshot, err = b.getSnapshot()
if err != nil {
b.err = err
return nil
Expand Down
2 changes: 1 addition & 1 deletion executor/point_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (b *executorBuilder) buildPointGet(p *plannercore.PointGetPlan) Executor {
e.base().maxChunkSize = 1
e.Init(p)

e.snapshot, err = b.getSnapshot(e)
e.snapshot, err = b.getSnapshot()
if err != nil {
b.err = err
return nil
Expand Down

0 comments on commit ffb32d9

Please sign in to comment.