MXS-1780 Collect server response information

As the router is the only one that knows what backends a particular
statement has been sent to, it is the responsibility of the router
to keep the session bookkeeping up to date. If it doesn't we will
know what statements a session has received (provided at least some
component in the routing chain has RCAP_TYPE_STMT_INPUT capability),
but not how long their processing took. Currently only readwritesplit
does that.

All queries are stored and not just COM_QUERY as that makes the
overall bookkeeping simpler; at clientReply() time we do not need to
know whether or not to bookkeep information, we can just do it.

When session information is queried for, we report as much information
we have available.
This commit is contained in:
Johan Wikman
2018-11-07 09:45:13 +02:00
parent c78c5a615d
commit c899f00541
4 changed files with 328 additions and 95 deletions

View File

@ -628,6 +628,26 @@ void session_set_retain_last_statements(uint32_t n);
*/
void session_retain_statement(MXS_SESSION* session, GWBUF* buffer);
/**
* @brief Book a server response for the statement currently being handled.
*
* @param session The session.
* @param server The server having returned a response.
* @param final_response True if this was the final server to respond,
* false otherwise.
*/
void session_book_server_response(MXS_SESSION* session, struct server* server, bool final_response);
/**
* @brief Reset the server bookkeeping for the current statement.
*
* To be called, e.g., after a transaction is rolled back (possibly with
* results having been reported) and before it is replayed.
*
* @param session The session.
*/
void session_reset_server_bookkeeping(MXS_SESSION* session);
/**
* @brief Dump the last statements, if statements have been retained.
*