MCPcopy
hub / github.com/grafana/tempo / openWriter

Method openWriter

tempodb/encoding/vparquet4/wal_block.go:396–417  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394}
395
396func (b *walBlock) openWriter() (err error) {
397 nextFile := len(b.flushed) + 1
398 filename := b.filepathOf(nextFile)
399
400 b.file, err = os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0o600)
401 if err != nil {
402 return fmt.Errorf("error opening file: %w", err)
403 }
404
405 if b.writer == nil {
406 b.writer = parquet.NewGenericWriter[*Trace](b.file, &parquet.WriterConfig{
407 Schema: parquetSchema,
408 // setting this value low massively reduces the amount of static memory we hold onto in highly multi-tenant environments at the cost of
409 // cutting pages more aggressively when writing column chunks
410 PageBufferSize: 1024,
411 })
412 } else {
413 b.writer.Reset(b.file)
414 }
415
416 return nil
417}
418
419func (b *walBlock) Flush() (err error) {
420 if b.ids.Len() == 0 {

Callers 2

createWALBlockFunction · 0.95
FlushMethod · 0.95

Calls 2

filepathOfMethod · 0.95
ResetMethod · 0.65

Tested by

no test coverage detected