diff --git a/lib/logstorage/pipe_field_names.go b/lib/logstorage/pipe_field_names.go index 1cc1b79cf..8d6e393fb 100644 --- a/lib/logstorage/pipe_field_names.go +++ b/lib/logstorage/pipe_field_names.go @@ -103,8 +103,8 @@ func (pfp *pipeFieldNamesProcessor) writeBlock(workerID uint, br *blockResult) { cs := br.getColumns() for _, c := range cs { - pHits, ok := m[c.name] - if !ok { + pHits := m[c.name] + if pHits == nil { nameCopy := strings.Clone(c.name) hits := uint64(0) pHits = &hits @@ -128,8 +128,8 @@ func (pfp *pipeFieldNamesProcessor) flush() error { shards = shards[1:] for i := range shards { for name, pHitsSrc := range shards[i].getM() { - pHits, ok := m[name] - if !ok { + pHits := m[name] + if pHits == nil { m[name] = pHitsSrc } else { *pHits += *pHitsSrc diff --git a/lib/logstorage/pipe_uniq.go b/lib/logstorage/pipe_uniq.go index 5228eb042..ddf043c58 100644 --- a/lib/logstorage/pipe_uniq.go +++ b/lib/logstorage/pipe_uniq.go @@ -217,8 +217,8 @@ func (shard *pipeUniqProcessorShard) writeBlock(br *blockResult) bool { func (shard *pipeUniqProcessorShard) updateState(v string, hits uint64) { m := shard.getM() - pHits, ok := m[v] - if !ok { + pHits := m[v] + if pHits == nil { vCopy := strings.Clone(v) hits := uint64(0) pHits = &hits diff --git a/lib/logstorage/storage_search.go b/lib/logstorage/storage_search.go index 2e269f85e..4144475ee 100644 --- a/lib/logstorage/storage_search.go +++ b/lib/logstorage/storage_search.go @@ -337,8 +337,8 @@ func (s *Storage) GetStreamFieldNames(ctx context.Context, tenantIDs []TenantID, m := make(map[string]*uint64) forEachStreamField(streams, func(f Field, hits uint64) { - pHits, ok := m[f.Name] - if !ok { + pHits := m[f.Name] + if pHits == nil { nameCopy := strings.Clone(f.Name) hitsLocal := uint64(0) pHits = &hitsLocal @@ -364,8 +364,8 @@ func (s *Storage) GetStreamFieldValues(ctx context.Context, tenantIDs []TenantID if f.Name != fieldName { return } - pHits, ok := m[f.Value] - if !ok { + pHits := m[f.Value] + if pHits == nil { valueCopy := strings.Clone(f.Value) hitsLocal := uint64(0) pHits = &hitsLocal