MXS-1734 Add statement dumping mechanism

With the configuration entry

   retain_last_statements=<unsigned>

or the debug flag '--debug=retain-last-statements=<unsigned>',
MaxScale will store the specified number of last statements
for each session. By calling

    session_dump_statements(session);

MaxScale will dump the last statements as NOTICE messages.
For debugging purposes.
This commit is contained in:
Johan Wikman
2018-03-22 15:31:13 +02:00
parent 6e859fcf02
commit 6d599395d4
6 changed files with 154 additions and 0 deletions

View File

@ -973,6 +973,8 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
}
set_qc_mode(session, &read_buffer);
session_retain_statement(session, read_buffer);
}
/** Update the current protocol command being executed */
else if (!process_client_commands(dcb, nbytes_read, &read_buffer))
@ -1408,6 +1410,7 @@ static int gw_client_hangup_event(DCB *dcb)
CHK_SESSION(session);
if (session->state != SESSION_STATE_DUMMY && !session_valid_for_pool(session))
{
session_dump_statements(session);
// The client did not send a COM_QUIT packet
modutil_send_mysql_err_packet(dcb, 0, 0, 1927, "08S01", "Connection killed by MaxScale");
}