From ab4c3817ed1e72f4db524520d5efeef1c12e993a Mon Sep 17 00:00:00 2001 From: Nikolay <nik@victoriametrics.com> Date: Wed, 30 Aug 2023 16:24:24 +0200 Subject: [PATCH] app/vminsert: fixes readonly check (#4892) * app/vminsert: fixes readonly check previously vminsert doesn't check readOnly state for vmstorage, since check was never performed for nil buffer In this case every 30 second storage node loss readonly state and received some data. It caused re-routing and possible slow down for ingestion https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4870 * wip --------- Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com> --- app/vminsert/netstorage/netstorage.go | 7 +++---- docs/CHANGELOG.md | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/vminsert/netstorage/netstorage.go b/app/vminsert/netstorage/netstorage.go index 502883d5f9..9f32e4eea6 100644 --- a/app/vminsert/netstorage/netstorage.go +++ b/app/vminsert/netstorage/netstorage.go @@ -320,10 +320,9 @@ var cannotCloseStorageNodeConnLogger = logger.WithThrottler("cannotCloseStorageN var cannotSendBufsLogger = logger.WithThrottler("cannotSendBufRows", 5*time.Second) func sendToConn(bc *handshake.BufferedConn, buf []byte) error { - if len(buf) == 0 { - // Nothing to send - return nil - } + // if len(buf) == 0, it must be sent to the vmstorage too in order to check for vmstorage health + // See checkReadOnlyMode() and https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4870 + timeoutSeconds := len(buf) / 3e5 if timeoutSeconds < 60 { timeoutSeconds = 60 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9d0e1bb5fb..9da7169286 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -17,6 +17,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * BUGFIX: [build](https://docs.victoriametrics.com/): fix Docker builds for old Docker releases. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4907). * BUGFIX: vmselect: correctly handle requests with `/select/multitenant` prefix. Such requests must be rejected since vmselect does not support multitenancy endpoint. Previously, such requests were causing panic. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4910). +* BUGFIX: [vminsert](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): properly check for [read-only state](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#readonly-mode) at `vmstorage`. Previously it wasn't properly checked, which could lead to increased resource usage and data ingestion slowdown when some of `vmstorage` nodes are in read-only mode. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4870). * BUGFIX: do not allow starting VictoriaMetrics components with improperly set boolean command-line flags in the form `-boolFlagName value`, since this leads to silent incomplete flags' parsing. This form should be replaced with `-boolFlagName=value`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4845). * BUGFIX: properly replace `:` chars in label names with `_` when `-usePromCompatibleNaming` command-line flag is passed to `vmagent`, `vminsert` or single-node VictoriaMetrics. This addresses [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3113#issuecomment-1275077071). * BUGFIX: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): correctly check if specified `-dst` belongs to specified `-storageDataPath`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4837).