Prune only when history size is exceeded
The documentation stated that at most `max_sescmd_history` commands were kept but in reality the number of commands kept in the history was one command smaller than what was documented.
This commit is contained in:
@ -517,7 +517,8 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_config.max_sescmd_history > 0 && m_sescmd_list.size() >= m_config.max_sescmd_history)
|
if (m_config.max_sescmd_history > 0 && m_sescmd_list.size() >= m_config.max_sescmd_history
|
||||||
|
&& !m_config.prune_sescmd_history)
|
||||||
{
|
{
|
||||||
static bool warn_history_exceeded = true;
|
static bool warn_history_exceeded = true;
|
||||||
if (warn_history_exceeded)
|
if (warn_history_exceeded)
|
||||||
@ -540,7 +541,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_config.prune_sescmd_history && !m_sescmd_list.empty()
|
if (m_config.prune_sescmd_history && !m_sescmd_list.empty()
|
||||||
&& m_sescmd_list.size() + 1 >= m_config.max_sescmd_history)
|
&& m_sescmd_list.size() >= m_config.max_sescmd_history)
|
||||||
{
|
{
|
||||||
// Close to the history limit, remove the oldest command
|
// Close to the history limit, remove the oldest command
|
||||||
prune_to_position(m_sescmd_list.front()->get_position());
|
prune_to_position(m_sescmd_list.front()->get_position());
|
||||||
|
|||||||
Reference in New Issue
Block a user