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

@ -89,6 +89,17 @@ public:
*/
bool eq(const SessionCommand& rhs) const;
/**
* Mark the session command as a re-execution of another command
*
* This function makes the current command's buffer a reference to the other
* command's buffer. The commands will still have separate positions and
* reply statuses.
*
* @param rhs Session command whose data is used
*/
void mark_as_duplicate(const SessionCommand& rhs);
private:
mxs::Buffer m_buffer; /**< The buffer containing the command */
uint8_t m_command; /**< The command being executed */