Skip to content

Commit 53c2eb1

Browse files
committed
util: resolve data race (pingcap#14610)
1 parent 7feff7a commit 53c2eb1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

util/stmtsummary/statement_summary.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,10 @@ func (ssElement *stmtSummaryByDigestElement) add(sei *StmtExecInfo, intervalSeco
727727
if commitDetails.GetCommitTsTime > ssElement.maxGetCommitTsTime {
728728
ssElement.maxGetCommitTsTime = commitDetails.GetCommitTsTime
729729
}
730-
ssElement.sumCommitBackoffTime += commitDetails.CommitBackoffTime
731-
if commitDetails.CommitBackoffTime > ssElement.maxCommitBackoffTime {
732-
ssElement.maxCommitBackoffTime = commitDetails.CommitBackoffTime
730+
commitBackoffTime := atomic.LoadInt64(&commitDetails.CommitBackoffTime)
731+
ssElement.sumCommitBackoffTime += commitBackoffTime
732+
if commitBackoffTime > ssElement.maxCommitBackoffTime {
733+
ssElement.maxCommitBackoffTime = commitBackoffTime
733734
}
734735
resolveLockTime := atomic.LoadInt64(&commitDetails.ResolveLockTime)
735736
ssElement.sumResolveLockTime += resolveLockTime

0 commit comments

Comments
 (0)