From 3d9f8b5020daf5e3759e6bf1570324d77a4cbe44 Mon Sep 17 00:00:00 2001 From: davidby-influx Date: Wed, 18 Nov 2020 19:39:42 -0800 Subject: [PATCH] fix(write): Successful writes increment write error statistics incorrectly. In v1.8.3 and earlier, the write path through (*PointsWriter) writeToShardWithContext() always increments the WriteErr count in the debug variables, and does not increment the WriteOK count. https://github.com/influxdata/influxdb/blob/v1.8.3/coordinator/points_writer.go line 450 should be an else if err != nil { instead of an else This has been reported in a customer cloud instance, and verified under a debugger. https://github.com/influxdata/influxdb/issues/20098 --- coordinator/points_writer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coordinator/points_writer.go b/coordinator/points_writer.go index 7c8410216a..012385f0b7 100644 --- a/coordinator/points_writer.go +++ b/coordinator/points_writer.go @@ -447,11 +447,10 @@ func (w *PointsWriter) writeToShardWithContext(ctx context.Context, shard *meta. atomic.AddInt64(&w.stats.WriteErr, 1) return err } - } else { + } else if err != nil { atomic.AddInt64(&w.stats.WriteErr, 1) return err } - atomic.AddInt64(&w.stats.WriteOK, 1) return nil }