Skip to content

Commit

Permalink
fix: Managed writer log message, timeout->flush (#536)
Browse files Browse the repository at this point in the history

This fixes the log message to reflect the correct case

---
  • Loading branch information
erezrokah committed Jan 1, 2023
1 parent f449234 commit 6b0c711
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/destination/managed_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func (p *Plugin) worker(ctx context.Context, metrics *Metrics, table *schema.Tab
if len(resources) > 0 {
start := time.Now()
if err := p.client.WriteTableBatch(ctx, table, resources); err != nil {
p.logger.Err(err).Str("table", table.Name).Int("len", len(resources)).Dur("time", time.Since(start)).Msg("failed to write batch on timeout")
p.logger.Err(err).Str("table", table.Name).Int("len", len(resources)).Dur("time", time.Since(start)).Msg("failed to write batch on flush")
// we don't return as we need to continue until channel is closed otherwise there will be a deadlock
atomic.AddUint64(&metrics.Errors, uint64(len(resources)))
} else {
p.logger.Info().Str("table", table.Name).Int("len", len(resources)).Dur("time", time.Since(start)).Msg("batch written successfully on timeout")
p.logger.Info().Str("table", table.Name).Int("len", len(resources)).Dur("time", time.Since(start)).Msg("batch written successfully on flush")
atomic.AddUint64(&metrics.Writes, uint64(len(resources)))
}
resources = make([][]any, 0)
Expand Down

1 comment on commit 6b0c711

@github-actions
Copy link

Choose a reason for hiding this comment

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

⏱️ Benchmark results

  • DefaultConcurrency-2 resources/s: 11,997
  • Glob-2 ns/op: 205.9
  • TablesWithChildrenDefaultConcurrency-2 resources/s: 28,336
  • BufferedScanner-2 ns/op: 12.61
  • LogReader-2 ns/op: 38.44

Please sign in to comment.