From 98706613fa324c3c6d0a8f1e97c02998e41f02f0 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Tue, 5 Mar 2024 13:08:50 +0000 Subject: [PATCH 1/2] fix: MixedBatchWriter should nil the slice instead of zeroing --- writers/mixedbatchwriter/mixedbatchwriter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writers/mixedbatchwriter/mixedbatchwriter.go b/writers/mixedbatchwriter/mixedbatchwriter.go index 49fb529d87..9ca998e5e4 100644 --- a/writers/mixedbatchwriter/mixedbatchwriter.go +++ b/writers/mixedbatchwriter/mixedbatchwriter.go @@ -229,7 +229,7 @@ func (m *insertBatchManager) flush(ctx context.Context) error { } m.logger.Debug().Int("len", batchSize).Dur("duration", time.Since(start)).Msg("batch written successfully") - m.batch = m.batch[:0] + m.batch = nil m.curBatchSizeBytes = 0 return nil } From 2864404c7f20d11566e6f13483ab4668900b0f6d Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Tue, 5 Mar 2024 13:37:54 +0000 Subject: [PATCH 2/2] One more place --- writers/mixedbatchwriter/mixedbatchwriter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writers/mixedbatchwriter/mixedbatchwriter.go b/writers/mixedbatchwriter/mixedbatchwriter.go index 9ca998e5e4..cca2a8b542 100644 --- a/writers/mixedbatchwriter/mixedbatchwriter.go +++ b/writers/mixedbatchwriter/mixedbatchwriter.go @@ -192,7 +192,7 @@ func (m *batchManager[A, T]) flush(ctx context.Context) error { if err != nil { return err } - m.batch = m.batch[:0] + m.batch = nil return nil }