Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit ab6d06f

Browse files
authored
Merge pull request #352 from grafana/20221024_divide-by-zero
Fix division by zero
2 parents effebc0 + e6a6ffd commit ab6d06f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/phlaredb/deduplicating_slice.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ func (s *deduplicatingSlice[M, K, H, P]) Close() error {
8383
}
8484

8585
func (s *deduplicatingSlice[M, K, H, P]) maxRowsPerRowGroup() int {
86+
// with empty slice we need to return early
87+
if len(s.slice) == 0 {
88+
return 1
89+
}
90+
8691
var (
8792
// average size per row in memory
8893
bytesPerRow = s.Size() / uint64(len(s.slice))

0 commit comments

Comments
 (0)