From ed3e423922941f0bf733f810815cfca3d554e02a Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Tue, 11 Feb 2020 18:06:53 +0200 Subject: [PATCH] lwt: add counter for a case where timeout is sent prematurely There is a case in current PAXOS implementation where timeout is returned because the code cannot guaranty whether the value is accepted or not in case of a contention. The counter will help to correlate this condition with failed requests. Message-Id: <20200211160653.30317-2-gleb@scylladb.com> --- service/storage_proxy.cc | 5 +++++ service/storage_proxy_stats.hh | 1 + 2 files changed, 6 insertions(+) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 3d4c8bb04a..3c11d24c6c 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1154,6 +1154,7 @@ future paxos_response_handler::accept_proposal(const paxos::proposal& prop // accepted, either. paxos::paxos_state::logger.trace("CAS[{}] accept_proposal: proposal is partially rejected", _id); tracing::trace(tr_state, "accept_proposal: proposal is partially rejected"); + _proxy->get_stats().cas_write_timeout_due_to_uncertainty++; // TODO: we report write timeout exception to be compatible with Cassandra, // which uses write_timeout_exception to signal any "unknown" state. // To be changed in scope of work on https://issues.apache.org/jira/browse/CASSANDRA-15350 @@ -1530,6 +1531,10 @@ void storage_proxy_stats::stats::register_stats() { sm::description("number of transaction preconditions that did not match current values"), {storage_proxy_stats::current_scheduling_group_label()}), + sm::make_total_operations("cas_write_timeout_due_to_uncertainty", cas_write_timeout_due_to_uncertainty, + sm::description("how many times write timeout was reported because of uncertainty in the result"), + {storage_proxy_stats::current_scheduling_group_label()}), + sm::make_histogram("cas_read_contention", sm::description("how many contended reads were encountered"), {storage_proxy_stats::current_scheduling_group_label()}, [this]{ return cas_read_contention.get_histogram(1, 8);}), diff --git a/service/storage_proxy_stats.hh b/service/storage_proxy_stats.hh index 653605fb6a..7acc3c159b 100644 --- a/service/storage_proxy_stats.hh +++ b/service/storage_proxy_stats.hh @@ -114,6 +114,7 @@ struct write_stats { uint64_t cas_write_unfinished_commit = 0; uint64_t cas_write_condition_not_met = 0; + uint64_t cas_write_timeout_due_to_uncertainty = 0; std::chrono::microseconds last_mv_flow_control_delay; // delay added for MV flow control in the last request public: