in executor/operation.go [167:227]
func (exec *Executor) addNsMapMetric(ns, op string, count int) {
var metricSum *uint64
switch op {
case "i":
val, ok := exec.metricInsertMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricInsertMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
case "u":
val, ok := exec.metricUpdateMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricUpdateMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
case "d":
val, ok := exec.metricDeleteMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricDeleteMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
case "c":
val, ok := exec.metricDDLMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricDDLMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
case "x":
val, ok := exec.metricUnknownMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricUnknownMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
case "e":
val, ok := exec.metricErrorMap.Load(ns)
if !ok {
storeVal := uint64(0)
exec.metricErrorMap.Store(ns, &storeVal)
metricSum = &storeVal
} else {
metricSum = val.(*uint64)
}
}
atomic.AddUint64(metricSum, uint64(count))
}