Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/segmentwriter/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *segment) flushBlock(stream flushStream) (*bufferpool.Buffer, *metastore
Datasets: make([]*metastorev1.Dataset, 0, len(stream.heads)),
}

blockFile := bufferpool.GetBuffer(len(stream.heads) * 2 / 1024) // rough estimate, 2kb per head
blockFile := bufferpool.GetBuffer(2 * 1024) // reserve extra to avoid resizes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe remember the size of the buffer between flushes?

Also 2k is likely too short

Not sure if you have access https://ops.grafana-ops.net/goto/bey8h9q72mu4gd?orgId=1

image

Do you know why was it divided by 1024? Was it a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The division was a typo - sorry about that, already fixed before comment.

Good point about buffer size - I tried to take a safe route, but it looks like - esp. considering how bufferpool works - it won't work. Will rethink


w := &writerOffset{Writer: blockFile}
for stream.Next() {
Expand Down
Loading