Repository navigation
Conversation
…h backoff Signed-off-by: Shoujun (Adrian) Diao <shoujun.diao@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In
elasticsearch-logger,fetch_and_update_es_versioncachesconf._es_version = falseafter any failedGET /version probe so that clusters denyingGET /(missing themonitorprivilege) do not get probed on every batch. However, if the very first probe fails due to a transient error (network timeout, connection refusal,408,429, or5xx), Elasticsearch 5/6 clusters get permanently stuck withconf._es_version = falseand never add_type = "_doc"to bulk action lines until the worker restarts or the route config changes.This PR distinguishes permanent probe failures from transient ones and adds rate-bounded retry recovery:
get_es_major_versionreturns a thirdretryableboolean:truefor HTTP client creation failures, network/timeout errors, and408/429/5xxresponses;falsefor other non-200 responses (e.g.401/403) and malformed JSON/version payloads.conf._es_version = falseimmediately and do not re-probe.conf._es_version_probeviaplugin.set_runtime_state) within_flightguard and capped exponential backoff (1s->2s-> ... ->60s, usingresty.core.time.monotonic_timewithngx.nowfallback). Once a later probe succeeds,conf._es_versionis cached and_es_version_probeis cleared.HTTP 200andresp_body.errors ~= true) without_typewhile transient probe retries are pending,conf._es_versionis markedfalseand_es_version_probeis cleared so Elasticsearch 7/8+ clusters that blockGET /with5xxstop retrying probes.t/plugin/elasticsearch-logger2.t(TEST 27-30) covering:503on the initial version probe, verifying no re-probe occurs inside the backoff window and_type: "_doc"is emitted after recovery.GET /always returns503.Follow-up to #14192 and #14238.
Which issue(s) this PR fixes:
Follow-up to #14192.
Checklist