Fix query average measurment and average text output.
The query_ended() call was not in the right spot. Tests did not detect it. Changed textual output to reflect the fact that they are for RWSplit reads.
This commit is contained in:
parent
84d45447fc
commit
f8c132903b
@ -571,7 +571,7 @@ void dprintServer(DCB* dcb, const SERVER* srv)
|
||||
{
|
||||
ave_os << "not available";
|
||||
}
|
||||
dcb_printf(dcb, "\tAverage response time: %s\n", ave_os.str().c_str());
|
||||
dcb_printf(dcb, "\tAdaptive avg. select time: %s\n", ave_os.str().c_str());
|
||||
|
||||
if (server->persistpoolmax)
|
||||
{
|
||||
@ -1448,6 +1448,9 @@ static json_t* server_json_attributes(const SERVER* server)
|
||||
json_object_set_new(stats, "active_operations", json_integer(server->stats.n_current_ops));
|
||||
json_object_set_new(stats, "routed_packets", json_integer(server->stats.packets));
|
||||
|
||||
maxbase::Duration response_ave(server_response_time_average(server));
|
||||
json_object_set_new(stats, "adaptive_avg_select_time", json_string(to_string(response_ave).c_str()));
|
||||
|
||||
json_object_set_new(attr, "statistics", stats);
|
||||
|
||||
return attr;
|
||||
|
@ -302,7 +302,7 @@ static void log_server_connections(select_criteria_t criteria, const SRWBackendL
|
||||
maxbase::Duration response_ave(server_response_time_average(b->server));
|
||||
std::ostringstream os;
|
||||
os << response_ave;
|
||||
MXS_INFO("Average response time : %s from \t[%s]:%d %s",
|
||||
MXS_INFO("adaptive avg. select time: %s from \t[%s]:%d %s",
|
||||
os.str().c_str(),
|
||||
b->server->address,
|
||||
b->server->port,
|
||||
|
@ -575,6 +575,17 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
mxb_assert(backend->get_reply_state() == REPLY_STATE_DONE);
|
||||
MXS_INFO("Reply complete, last reply from %s", backend->name());
|
||||
|
||||
ResponseStat& stat = backend->response_stat();
|
||||
stat.query_ended();
|
||||
if (stat.is_valid() && (stat.sync_time_reached()
|
||||
|| server_response_time_num_samples(backend->server()) == 0))
|
||||
{
|
||||
server_add_response_average(backend->server(),
|
||||
stat.average().secs(),
|
||||
stat.num_samples());
|
||||
stat.reset();
|
||||
}
|
||||
|
||||
if (m_config.causal_reads)
|
||||
{
|
||||
// The reply should never be complete while we are still waiting for the header.
|
||||
@ -650,18 +661,6 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
m_can_replay_trx = true;
|
||||
}
|
||||
|
||||
|
||||
ResponseStat& stat = backend->response_stat();
|
||||
stat.query_ended();
|
||||
if (stat.is_valid() && (stat.sync_time_reached()
|
||||
|| server_response_time_num_samples(backend->server()) == 0))
|
||||
{
|
||||
server_add_response_average(backend->server(),
|
||||
stat.average().secs(),
|
||||
stat.num_samples());
|
||||
stat.reset();
|
||||
}
|
||||
|
||||
if (backend->in_use() && backend->has_session_commands())
|
||||
{
|
||||
// Backend is still in use and has more session commands to execute
|
||||
|
Loading…
x
Reference in New Issue
Block a user