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

Method openWriter

tempodb/encoding/vparquet5/wal_block.go:408–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

406}
407
408func (b *walBlock) openWriter() (err error) {
409 nextFile := len(b.flushed) + 1
410 filename := b.filepathOf(nextFile)
411
412 b.file, err = os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0o600)
413 if err != nil {
414 return fmt.Errorf("error opening file: %w", err)
415 }
416
417 if b.writer == nil {
418 _, writerOptions, _ := SchemaWithDynamicChanges(b.meta.DedicatedColumns)
419
420 // setting this value low massively reduces the amount of static memory we hold onto in highly multi-tenant environments at the cost of
421 // cutting pages more aggressively when writing column chunks
422 writerOptions = append(writerOptions, parquet.PageBufferSize(1024))
423
424 b.writer = parquet.NewGenericWriter[*Trace](b.file, writerOptions...)
425 } else {
426 b.writer.Reset(b.file)
427 }
428
429 return nil
430}
431
432func (b *walBlock) Flush() (err error) {
433 if b.ids.Len() == 0 {

Callers 2

createWALBlockFunction · 0.95
FlushMethod · 0.95

Calls 3

filepathOfMethod · 0.95
SchemaWithDynamicChangesFunction · 0.85
ResetMethod · 0.65

Tested by

no test coverage detected