| 1986 | } |
| 1987 | |
| 1988 | void ClientRequestState::MarkActive() { |
| 1989 | client_wait_sw_.Stop(); |
| 1990 | int64_t elapsed_time = client_wait_sw_.ElapsedTime(); |
| 1991 | // If we have reached eos, then the query is already complete, |
| 1992 | // and we should not accumulate more client wait time. This mostly |
| 1993 | // impacts the finalization step, where the client is closing the |
| 1994 | // query and does not need any more rows. Fetching may have already |
| 1995 | // completed prior to this point, so finalization time should not |
| 1996 | // count in that case. If the fetch was incomplete, then the client |
| 1997 | // time should be counted for finalization as well. |
| 1998 | if (!eos()) { |
| 1999 | client_wait_timer_->Set(elapsed_time); |
| 2000 | // The first call is before any MarkInactive() call has run and produces |
| 2001 | // a zero-length sample. Skip this zero-length sample (but not any later |
| 2002 | // zero-length samples). |
| 2003 | if (elapsed_time != 0 || last_client_wait_time_ != 0) { |
| 2004 | int64_t current_wait_time = elapsed_time - last_client_wait_time_; |
| 2005 | client_wait_time_stats_->UpdateCounter(current_wait_time); |
| 2006 | } |
| 2007 | last_client_wait_time_ = elapsed_time; |
| 2008 | } |
| 2009 | lock_guard<mutex> l(expiration_data_lock_); |
| 2010 | last_active_time_ms_ = UnixMillis(); |
| 2011 | ++ref_count_; |
| 2012 | } |
| 2013 | |
| 2014 | // Used by RETURN_IF_CANCELLED. |
| 2015 | bool ClientRequestState::is_cancelled() { |
nothing calls this directly
no test coverage detected