Skip to content

Commit

Permalink
Fix the panic message of MemQuota.Record (#10479)
Browse files Browse the repository at this point in the history
close #10478
  • Loading branch information
flowbehappy authored Jan 20, 2024
1 parent 2f529bf commit b1c22cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cdc/processor/memquota/mem_quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@ func (m *MemQuota) Record(span tablepb.Span, resolved model.ResolvedTs, nBytes u
// Can't find the table record, the table must be removed.
usedBytes := m.usedBytes.Load()
if usedBytes < nBytes {
log.Panic("MemQuota.refund fail",
zap.Uint64("used", usedBytes), zap.Uint64("refund", nBytes))
log.Panic("MemQuota.record fail",
zap.Uint64("used", usedBytes), zap.Uint64("record", nBytes))
}
// If we cannot find the table, then the previous acquired memory quota needed to be returned.
// Note that "usedBytes.Add(^(nBytes - 1))" means "usedBytes.Sub(nBytes)". But atomic don't
// have Sub method.
if m.usedBytes.Add(^(nBytes - 1)) < m.totalBytes {
m.blockAcquireCond.Broadcast()
}
Expand Down

0 comments on commit b1c22cf

Please sign in to comment.