Skip to content

Display warnings when request failed #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/cassandra/cluster/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ def execute_by_plan(promise,
unless pool
errors ||= {}
errors[host] = NOT_CONNECTED
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{errors[host].class.name}: #{errors[host]})")
return execute_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -602,6 +603,7 @@ def execute_by_plan(promise,
(e.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
execute_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -635,6 +637,7 @@ def execute_by_plan(promise,
rescue => e
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
execute_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -705,6 +708,7 @@ def prepare_and_send_request_by_plan(host,
(e.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
execute_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -749,6 +753,7 @@ def batch_by_plan(promise,
unless pool
errors ||= {}
errors[host] = NOT_CONNECTED
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{errors[host].class.name}: #{errors[host]})")
return batch_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -785,6 +790,7 @@ def batch_by_plan(promise,
(e.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
batch_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -818,6 +824,7 @@ def batch_by_plan(promise,
rescue => e
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
batch_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -914,6 +921,7 @@ def batch_and_send_request_by_plan(host,
(e.is_a?(Errors::TimeoutError) && batch_statement.idempotent?)
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
batch_by_plan(promise,
keyspace,
batch_statement,
Expand Down Expand Up @@ -956,6 +964,7 @@ def send_request_by_plan(promise,
unless pool
errors ||= {}
errors[host] = NOT_CONNECTED
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{errors[host].class.name}: #{errors[host]})")
return send_request_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -992,6 +1001,7 @@ def send_request_by_plan(promise,
(e.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
send_request_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -1025,6 +1035,7 @@ def send_request_by_plan(promise,
rescue => e
errors ||= {}
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
send_request_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -1147,6 +1158,7 @@ def handle_response(response_future,
if e.is_a?(Errors::HostError) ||
(e.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors[host] = e
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{e.class.name}: #{e})")
execute_by_plan(promise,
keyspace,
statement,
Expand Down Expand Up @@ -1174,6 +1186,7 @@ def handle_response(response_future,
if error.is_a?(Errors::HostError) ||
(error.is_a?(Errors::TimeoutError) && statement.idempotent?)
errors[host] = error
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{error.class.name}: #{error})")

case request
when Protocol::QueryRequest, Protocol::PrepareRequest
Expand Down Expand Up @@ -1355,6 +1368,7 @@ def handle_response(response_future,
hosts,
request.consistency,
retries)
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{errors[host].class.name}: #{errors[host]})")
case request
when Protocol::QueryRequest, Protocol::PrepareRequest
send_request_by_plan(promise,
Expand Down Expand Up @@ -1435,6 +1449,7 @@ def handle_response(response_future,
(ex.is_a?(Errors::TimeoutError) && statement.idempotent?)

errors[host] = ex
@logger.warn("Failed to send a request to #{host.ip} on #{retries + 1}th try (#{ex.class.name}: #{ex})")
case request
when Protocol::QueryRequest, Protocol::PrepareRequest
send_request_by_plan(promise,
Expand Down