Share data between identical session commands

If two or more session commands contain identical buffers, the buffer of
the first session command is shared between the others. This reduces the
amount of memory used to store repeated executions of session commands.

The purging of session command history in readwritesplit was replaced with
session command de-duplication. This was done to prevent problems that
could arise when the order of session commands plays a significant role.
This commit is contained in:
Markus Mäkelä
2018-07-01 15:54:29 +03:00
parent 295d59881e
commit 9d5b8c8de2
4 changed files with 34 additions and 41 deletions

View File

@ -92,4 +92,11 @@ std::string SessionCommand::to_string()
return str;
}
void SessionCommand::mark_as_duplicate(const SessionCommand& rhs)
{
ss_dassert(eq(rhs));
// The commands now share the mxs::Buffer that contains the actual command
m_buffer = rhs.m_buffer;
}
}