Skip to content

Commit b032344

Browse files
committed
Do not retry on 413 response codes
Previously when Elasticsearch responds with a 413 (Payload Too Large) status, the manticore adapter raises an error before the response can be processed by the bulk_send error handling. This commit updates the adpapter to pass through the response code without raising an exception so that it can be properly handled. NOTE: this only applies to code 413 even though there may be arguably other error codes that should not be retried. The scope of this work is simply to 413 where we have explicit handling.
1 parent de61518 commit b032344

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ def perform_request(url, method, path, params={}, body=nil)
7777
end
7878

7979
# 404s are excluded because they are valid codes in the case of
80-
# template installation. We might need a better story around this later
81-
# but for our current purposes this is correct
80+
# template installation. 413s are excluded to allow the bulk_send
81+
# error handling to process "Payload Too Large" responses rather
82+
# than triggering retries.
8283
code = resp.code
83-
if code < 200 || code > 299 && code != 404
84+
if code < 200 || (code > 299 && ![404, 413].include?(code))
8485
raise ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError.new(code, request_uri, body, resp.body)
8586
end
8687

0 commit comments

Comments
 (0)