Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]util,executor: Fix incorrect execution info issue of pessimistic lock error #60056

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions pkg/executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1532,10 +1532,8 @@ func (e *InsertRuntimeStat) Clone() execdetails.RuntimeStats {
snapshotStats := e.SnapshotRuntimeStats.Clone()
newRs.SnapshotRuntimeStats = snapshotStats
}
if e.BasicRuntimeStats != nil {
basicStats := e.BasicRuntimeStats.Clone()
newRs.BasicRuntimeStats = basicStats.(*execdetails.BasicRuntimeStats)
}
// BasicRuntimeStats is unique for all executor instances mapping to the same plan id
newRs.BasicRuntimeStats = e.BasicRuntimeStats
if e.AllocatorRuntimeStats != nil {
newRs.AllocatorRuntimeStats = e.AllocatorRuntimeStats.Clone()
}
Expand All @@ -1556,13 +1554,8 @@ func (e *InsertRuntimeStat) Merge(other execdetails.RuntimeStats) {
e.SnapshotRuntimeStats.Merge(tmp.SnapshotRuntimeStats)
}
}
if tmp.BasicRuntimeStats != nil {
if e.BasicRuntimeStats == nil {
basicStats := tmp.BasicRuntimeStats.Clone()
e.BasicRuntimeStats = basicStats.(*execdetails.BasicRuntimeStats)
} else {
e.BasicRuntimeStats.Merge(tmp.BasicRuntimeStats)
}
if tmp.BasicRuntimeStats != nil && e.BasicRuntimeStats == nil {
e.BasicRuntimeStats = tmp.BasicRuntimeStats
}
if tmp.AllocatorRuntimeStats != nil {
if e.AllocatorRuntimeStats == nil {
Expand Down
11 changes: 2 additions & 9 deletions pkg/util/execdetails/execdetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -1543,14 +1543,7 @@ func (e *BasicRuntimeStats) GetActRows() int64 {

// Clone implements the RuntimeStats interface.
func (e *BasicRuntimeStats) Clone() RuntimeStats {
result := &BasicRuntimeStats{}
result.executorCount.Store(e.executorCount.Load())
result.loop.Store(e.loop.Load())
result.consume.Store(e.consume.Load())
result.open.Store(e.open.Load())
result.close.Store(e.close.Load())
result.rows.Store(e.rows.Load())
return result
panic("BasicRuntimeStats should not implement Clone function")
}

// Merge implements the RuntimeStats interface.
Expand Down Expand Up @@ -1718,7 +1711,7 @@ func (e *RuntimeStatsColl) RegisterStats(planID int, info RuntimeStats) {
}
}
if !found {
stats.groupRss = append(stats.groupRss, info)
stats.groupRss = append(stats.groupRss, info.Clone())
}
}

Expand Down