From 35b0db270ceb09dd081d7b32d6c88be72f059eab Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Fri, 15 Dec 2023 11:43:41 +0100 Subject: [PATCH] vmctl: retry requests that failed in the very end for `vm-native` (#5475) Before, retries happened only on writes into a network connection between source and destination. But errors returned by server after all the data was transmitted were logged, but not retried. Signed-off-by: hagen1778 --- app/vmctl/vm_native.go | 12 ++++-------- docs/CHANGELOG.md | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/vmctl/vm_native.go b/app/vmctl/vm_native.go index 31bdb6b38..042535280 100644 --- a/app/vmctl/vm_native.go +++ b/app/vmctl/vm_native.go @@ -125,13 +125,10 @@ func (p *vmNativeProcessor) runSingle(ctx context.Context, f native.Filter, srcU } pr, pw := io.Pipe() - done := make(chan struct{}) + importCh := make(chan error) go func() { - defer func() { close(done) }() - if err := p.dst.ImportPipe(ctx, dstURL, pr); err != nil { - logger.Errorf("error initialize import pipe: %s", err) - return - } + importCh <- p.dst.ImportPipe(ctx, dstURL, pr) + close(importCh) }() w := io.Writer(pw) @@ -153,9 +150,8 @@ func (p *vmNativeProcessor) runSingle(ctx context.Context, f native.Filter, srcU if err := pw.Close(); err != nil { return err } - <-done - return nil + return <-importCh } func (p *vmNativeProcessor) runBackfilling(ctx context.Context, tenantID string, ranges [][]time.Time, silent bool) error { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4c102af05..9338f015a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,8 +14,9 @@ The following `tip` changes can be tested by building VictoriaMetrics components * BUGFIX: `vminsert`: properly accept samples via [OpenTelemetry data ingestion protocol](https://docs.victoriametrics.com/#sending-data-via-opentelemetry) when these samples have no [resource attributes](https://opentelemetry.io/docs/instrumentation/go/resources/). Previously such samples were silently skipped. * BUGFIX: `vmstorage`: added missing `-inmemoryDataFlushInterval` command-line flag, which was missing in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html) after implementing [this feature](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3337) in [v1.85.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.85.0). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): check `-external.url` schema when starting vmalert, must be `http` or `https`. Before, alertmanager could reject alert notifications if `-external.url` contained no or wrong schema. -* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle queries, which wrap [rollup functions](https://docs.victoriametrics.com/MetricsQL.html#rollup-functions) with multiple arguments without explicitly specified lookbehind window in square brackets into [aggregate functions](https://docs.victoriametrics.com/MetricsQL.html#aggregate-functions). For example, `sum(quantile_over_time(0.5, process_resident_memory_bytes))` was resulting to `expecting at least 2 args to ...; got 1 args' error. Thanks to @atykhyy for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5414). +* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle queries, which wrap [rollup functions](https://docs.victoriametrics.com/MetricsQL.html#rollup-functions) with multiple arguments without explicitly specified lookbehind window in square brackets into [aggregate functions](https://docs.victoriametrics.com/MetricsQL.html#aggregate-functions). For example, `sum(quantile_over_time(0.5, process_resident_memory_bytes))` was resulting to `expecting at least 2 args to ...; got 1 args` error. Thanks to @atykhyy for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5414). * BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): check for Error field in response from influx client during migration. Before, only network errors were checked. Thanks to @wozz for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5446). +* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): retry on import errors in `vm-native` mode. Before, retries happened only on writes into a network connection between source and destination. But errors returned by server after all the data was transmitted were logged, but not retried. ## [v1.93.9](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.9)