app/vmselect: fixes partial response with replicationFactor (#2777)

* app/vmselect: fixes partial response with replicationFactor
Allow partial response if it meets replicationFactor configured at vmselect
https://t.me/VictoriaMetrics_ru1/38490

* docs/CHANGELOG.md: document this change

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
This commit is contained in:
Nikolay 2022-06-23 19:17:24 +02:00 committed by GitHub
parent f0c1edb175
commit ee5c502446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -1380,11 +1380,6 @@ func (snr *storageNodesRequest) collectResults(partialResultsCounter *metrics.Co
// passed to startStorageNodesRequest must be finished until the deadline. // passed to startStorageNodesRequest must be finished until the deadline.
result := <-snr.resultsCh result := <-snr.resultsCh
if err := f(result); err != nil { if err := f(result); err != nil {
if snr.denyPartialResponse {
// Immediately return the error to the caller if partial responses are denied.
// There is no need to wait for responses from other vmstorage nodes - they will be processed in background.
return false, err
}
var er *errRemote var er *errRemote
if errors.As(err, &er) { if errors.As(err, &er) {
// Immediately return the error reported by vmstorage to the caller, // Immediately return the error reported by vmstorage to the caller,
@ -1393,6 +1388,12 @@ func (snr *storageNodesRequest) collectResults(partialResultsCounter *metrics.Co
return false, err return false, err
} }
errsPartial = append(errsPartial, err) errsPartial = append(errsPartial, err)
if snr.denyPartialResponse && len(errsPartial) >= *replicationFactor {
// Return the error to the caller if partial responses are denied
// and the number of partial responses reach -replicationFactor,
// since this means that the response is partial.
return false, err
}
continue continue
} }
resultsCollected++ resultsCollected++

View File

@ -29,6 +29,7 @@ scrape_configs:
``` ```
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): make sure that [stale markers](https://docs.victoriametrics.com/vmagent.html#prometheus-staleness-markers) are generated with the actual timestamp when unsuccessful scrape occurs. This should prevent from possible time series overlap on scrape target restart in dynmaic envirnoments such as Kubernetes. * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): make sure that [stale markers](https://docs.victoriametrics.com/vmagent.html#prometheus-staleness-markers) are generated with the actual timestamp when unsuccessful scrape occurs. This should prevent from possible time series overlap on scrape target restart in dynmaic envirnoments such as Kubernetes.
* BUGFIX: [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): assume that the response is complete if `-search.denyPartialResponse` is enabled and up to `-replicationFactor - 1` `vmstorage` nodes are unavailable. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1767).
## [v1.78.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.78.0) ## [v1.78.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.78.0)