()
| 406 | } |
| 407 | |
| 408 | func (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 | |
| 432 | func (b *walBlock) Flush() (err error) { |
| 433 | if b.ids.Len() == 0 { |
no test coverage detected