mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
app/vmselect/netstorage: do not query Go maps with unsafe string keys, since this breaks in Go 1.17
This commit is contained in:
parent
b709fa387a
commit
cbb81c2ce9
@ -1253,12 +1253,10 @@ func (tbfw *tmpBlocksFileWrapper) RegisterAndWriteBlock(mb *storage.MetricBlock)
|
||||
tmpBufPool.Put(bb)
|
||||
if err == nil {
|
||||
metricName := mb.MetricName
|
||||
metricNameStrUnsafe := bytesutil.ToUnsafeString(metricName)
|
||||
addrs := tbfw.m[metricNameStrUnsafe]
|
||||
addrs := tbfw.m[string(metricName)]
|
||||
addrs = append(addrs, addr)
|
||||
if len(addrs) > 1 {
|
||||
// An optimization: avoid memory allocation and copy for already existing metricName key in tbfw.m.
|
||||
tbfw.m[metricNameStrUnsafe] = addrs
|
||||
tbfw.m[string(metricName)] = addrs
|
||||
} else {
|
||||
// An optimization for big number of time series with long names: store only a single copy of metricNameStr
|
||||
// in both tbfw.orderedMetricNames and tbfw.m.
|
||||
|
Loading…
Reference in New Issue
Block a user