diff --git a/cql3/statements/select_statement.cc b/cql3/statements/select_statement.cc index 95fdba49df..47530a31f1 100644 --- a/cql3/statements/select_statement.cc +++ b/cql3/statements/select_statement.cc @@ -161,8 +161,8 @@ select_statement::select_statement(schema_ptr schema, _opts.set_if(_is_reversed); } -db::timeout_clock::duration select_statement::get_timeout(const query_options& options) const { - return _attrs->is_timeout_set() ? _attrs->get_timeout(options) : options.get_timeout_config().*get_timeout_config_selector(); +db::timeout_clock::duration select_statement::get_timeout(const service::client_state& state, const query_options& options) const { + return _attrs->is_timeout_set() ? _attrs->get_timeout(options) : state.get_timeout_config().*get_timeout_config_selector(); } ::shared_ptr select_statement::get_result_metadata() const { @@ -371,7 +371,7 @@ select_statement::do_execute(service::storage_proxy& proxy, } command->slice.options.set(); - auto timeout_duration = get_timeout(options); + auto timeout_duration = get_timeout(state.get_client_state(), options); auto timeout = db::timeout_clock::now() + timeout_duration; auto p = service::pager::query_pagers::pager(_schema, _selection, state, options, command, std::move(key_ranges), restrictions_need_filtering ? _restrictions : nullptr); @@ -518,7 +518,7 @@ indexed_table_select_statement::do_execute_base_query( lw_shared_ptr paging_state) const { using value_type = std::tuple>, lw_shared_ptr>; auto cmd = prepare_command_for_base_query(proxy, options, state, now, bool(paging_state)); - auto timeout = db::timeout_clock::now() + get_timeout(options); + auto timeout = db::timeout_clock::now() + get_timeout(state.get_client_state(), options); uint32_t queried_ranges_count = partition_ranges.size(); service::query_ranges_to_vnodes_generator ranges_to_vnodes(proxy.get_token_metadata_ptr(), _schema, std::move(partition_ranges)); @@ -612,7 +612,7 @@ indexed_table_select_statement::do_execute_base_query( lw_shared_ptr paging_state) const { using value_type = std::tuple>, lw_shared_ptr>; auto cmd = prepare_command_for_base_query(proxy, options, state, now, bool(paging_state)); - auto timeout = db::timeout_clock::now() + get_timeout(options); + auto timeout = db::timeout_clock::now() + get_timeout(state.get_client_state(), options); struct base_query_state { query::result_merger merger; @@ -694,7 +694,7 @@ select_statement::execute(service::storage_proxy& proxy, // is specified we need to get "limit" rows from each partition since there // is no way to tell which of these rows belong to the query result before // doing post-query ordering. - auto timeout = db::timeout_clock::now() + get_timeout(options); + auto timeout = db::timeout_clock::now() + get_timeout(state.get_client_state(), options); if (needs_post_query_ordering() && _limit) { return do_with(std::forward(partition_ranges), [this, &proxy, &state, &options, cmd, timeout](auto& prs) { assert(cmd->partition_limit == query::max_partitions); @@ -1259,7 +1259,7 @@ indexed_table_select_statement::find_index_partition_ranges(service::storage_pro { using value_type = std::tuple>; auto now = gc_clock::now(); - auto timeout = db::timeout_clock::now() + get_timeout(options); + auto timeout = db::timeout_clock::now() + get_timeout(state.get_client_state(), options); return read_posting_list(proxy, options, get_limit(options), state, now, timeout, false).then( [this, now, &options] (::shared_ptr rows) { auto rs = cql3::untyped_result_set(rows); @@ -1300,7 +1300,7 @@ indexed_table_select_statement::find_index_clustering_rows(service::storage_prox { using value_type = std::tuple, lw_shared_ptr>; auto now = gc_clock::now(); - auto timeout = db::timeout_clock::now() + get_timeout(options); + auto timeout = db::timeout_clock::now() + get_timeout(state.get_client_state(), options); return read_posting_list(proxy, options, get_limit(options), state, now, timeout, true).then( [this, now, &options] (::shared_ptr rows) { diff --git a/cql3/statements/select_statement.hh b/cql3/statements/select_statement.hh index c0b8a54291..df7d91d286 100644 --- a/cql3/statements/select_statement.hh +++ b/cql3/statements/select_statement.hh @@ -147,7 +147,7 @@ public: bool has_group_by() const { return _group_by_cell_indices && !_group_by_cell_indices->empty(); } - db::timeout_clock::duration get_timeout(const query_options& options) const; + db::timeout_clock::duration get_timeout(const service::client_state& state, const query_options& options) const; protected: uint64_t do_get_limit(const query_options& options, ::shared_ptr limit, uint64_t default_limit) const;