MXS-1502: Log session command warning only once

The warning that tells the user that the session command history has been
exceeded is now only logged once. This is to prevent the message from
being repeatedly logged when the default value is not large enough.

Also fixed the session_limits test to use distinct session commands. This
way the session command history compaction is not in effect and the test
again tests the correct thing.
This commit is contained in:
Markus Mäkelä 2018-03-31 17:43:46 +03:00
parent 07821970ff
commit 36b10d3f05
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 11 additions and 6 deletions

View File

@ -40,11 +40,11 @@ int main(int argc, char *argv[])
test.maxscales->connect_maxscale(0);
for (int i = 0; i < 10; i++)
{
test.try_query(test.maxscales->conn_rwsplit[0], "set @test=1");
test.try_query(test.maxscales->conn_rwsplit[0], std::string("set @test=" + std::to_string(i)).c_str());
}
test.tprintf("Execute one more session command and expect message in error log");
execute_query(test.maxscales->conn_rwsplit[0], "set @test=1");
execute_query(test.maxscales->conn_rwsplit[0], "set @test=11");
sleep(1);
test.check_log_err(0, "Router session exceeded session command history limit", true);
test.maxscales->close_maxscale_connections(0);

View File

@ -379,10 +379,15 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
if (rses->rses_config.max_sescmd_history > 0 &&
rses->sescmd_list.size() >= rses->rses_config.max_sescmd_history)
{
MXS_WARNING("Router session exceeded session command history limit. "
"Slave recovery is disabled and only slave servers with "
"consistent session state are used "
"for the duration of the session.");
static bool warn_history_exceeded = true;
if (warn_history_exceeded)
{
MXS_WARNING("Router session exceeded session command history limit. Slave "
"recovery is disabled and only slave servers with consistent "
"session state are used for the duration of the session.");
warn_history_exceeded = false;
}
rses->rses_config.disable_sescmd_history = true;
rses->rses_config.max_sescmd_history = 0;
rses->sescmd_list.clear();